Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#93: added an option to choose between the javax and jakarta generated annotation. #97

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}