Skip to content

Commit

Permalink
assertj#93: added an option to choose between the javax and jakarta g…
Browse files Browse the repository at this point in the history
…enerated annotation.
  • Loading branch information
Zegveld committed Jan 14, 2022
1 parent ae656e8 commit 3746f90
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.assertj.assertions.generator.GeneratedAnnotationSource;
import org.assertj.core.util.VisibleForTesting;
import org.assertj.maven.generator.AssertionsGenerator;
import org.assertj.maven.generator.AssertionsGeneratorReport;
Expand Down Expand Up @@ -198,6 +199,12 @@ public class AssertJAssertionsGeneratorMojo extends AbstractMojo {
@Parameter(property = "assertj.includePackagePrivateClasses")
public boolean includePackagePrivateClasses = false;

/**
* Where the @Generated annotation should come from. Options: JAVAX (default), JAKARTA, NONE.
*/
@Parameter(property = "assertj.annotationSource")
public GeneratedAnnotationSource generatedAnnotationSource = GeneratedAnnotationSource.JAVAX;

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
if (skip) {
Expand All @@ -211,6 +218,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
assertionGenerator.generateAssertionsForAllFields(this.generateAssertionsForAllFields);
assertionGenerator.setIncludePatterns(includes);
assertionGenerator.setExcludePatterns(excludes);
assertionGenerator.setGeneratedAnnotationSource(generatedAnnotationSource);
if (generateAssertions) assertionGenerator.enableEntryPointClassesGenerationFor(STANDARD);
if (generateBddAssertions) assertionGenerator.enableEntryPointClassesGenerationFor(BDD);
if (generateSoftAssertions) assertionGenerator.enableEntryPointClassesGenerationFor(SOFT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.apache.maven.plugin.logging.Log;
import org.assertj.assertions.generator.AssertionsEntryPointType;
import org.assertj.assertions.generator.BaseAssertionGenerator;
import org.assertj.assertions.generator.GeneratedAnnotationSource;
import org.assertj.assertions.generator.Template;
import org.assertj.assertions.generator.description.ClassDescription;
import org.assertj.assertions.generator.description.converter.ClassToClassDescriptionConverter;
Expand Down Expand Up @@ -203,4 +204,8 @@ public void generateAssertionsForAllFields(boolean generateAssertionsForAllField
public void setGeneratedAssertionsPackage(String generateAssertionsInPackage) {
this.generator.setGeneratedAssertionsPackage(generateAssertionsInPackage);
}

public void setGeneratedAnnotationSource(GeneratedAnnotationSource generatedAnnotationSource) {
generator.setGeneratedAnnotationSource(generatedAnnotationSource);
}
}

0 comments on commit 3746f90

Please sign in to comment.