2020
2121import javax .inject .Inject ;
2222
23- import org .apache .maven .api .plugin .testing .*;
23+ import org .apache .maven .api .plugin .testing .Basedir ;
24+ import org .apache .maven .api .plugin .testing .InjectMojo ;
25+ import org .apache .maven .api .plugin .testing .MojoParameter ;
2426import org .apache .maven .api .plugin .testing .MojoParameters ;
27+ import org .apache .maven .api .plugin .testing .MojoTest ;
2528import org .apache .maven .plugin .logging .Log ;
2629import org .junit .jupiter .api .Test ;
27- import org .slf4j .Logger ;
28- import org .slf4j .LoggerFactory ;
2930
30- import static org .junit .jupiter .api .Assertions .*;
31+ import static org .junit .jupiter .api .Assertions .assertDoesNotThrow ;
32+ import static org .junit .jupiter .api .Assertions .assertEquals ;
3133
3234@ MojoTest
3335public class ParametersMojoTest {
3436
35- private static final Logger logger = LoggerFactory .getLogger (ParametersMojoTest .class );
36-
3737 private static final String POM_DOT_XML_FILE = "pom.xml" ;
3838
3939 private static final String DEFAULT_POM_DIR = "src/test/projects/default/" ;
@@ -54,7 +54,7 @@ void testDefaultPom(ParametersMojo mojo) {
5454 @ Test
5555 @ InjectMojo (goal = "test:test-plugin:0.0.1-SNAPSHOT:parameters" , pom = EXPLICIT_POM_DIR + POM_DOT_XML_FILE )
5656 void testExplicitPom (ParametersMojo mojo ) {
57- assertEquals ("explicitValue" , mojo .plain );
57+ assertEquals ("explicitValue" , mojo .getPlain () );
5858 assertDoesNotThrow (mojo ::execute );
5959 }
6060
@@ -76,8 +76,8 @@ void simpleMojo(ParametersMojo mojo) {
7676 @ MojoParameter (name = "plain" , value = "plainValue" )
7777 @ MojoParameter (name = "withDefault" , value = "withDefaultValue" )
7878 void simpleMojoWithParameters (ParametersMojo mojo ) {
79- assertEquals ("plainValue" , mojo .plain );
80- assertEquals ("withDefaultValue" , mojo .withDefault );
79+ assertEquals ("plainValue" , mojo .getPlain () );
80+ assertEquals ("withDefaultValue" , mojo .getWithDefault () );
8181 assertDoesNotThrow (mojo ::execute );
8282 }
8383
@@ -88,32 +88,32 @@ void simpleMojoWithParameters(ParametersMojo mojo) {
8888 @ MojoParameter (name = "withDefault" , value = "withDefaultValue" )
8989 })
9090 void simpleMojoWithParametersGroupingAnnotation (ParametersMojo mojo ) {
91- assertEquals ("plainValue" , mojo .plain );
92- assertEquals ("withDefaultValue" , mojo .withDefault );
91+ assertEquals ("plainValue" , mojo .getPlain () );
92+ assertEquals ("withDefaultValue" , mojo .getWithDefault () );
9393 assertDoesNotThrow (mojo ::execute );
9494 }
9595
9696 @ Test
9797 @ InjectMojo (goal = "test:test-plugin:0.0.1-SNAPSHOT:parameters" , pom = DEFAULT_POM_DIR + POM_DOT_XML_FILE )
9898 @ MojoParameter (name = "plain" , value = "plainValue" )
9999 void simpleMojoWithParameter (ParametersMojo mojo ) {
100- assertEquals ("plainValue" , mojo .plain );
100+ assertEquals ("plainValue" , mojo .getPlain () );
101101 assertDoesNotThrow (mojo ::execute );
102102 }
103103
104104 @ Test
105105 @ MojoParameter (name = "plain" , value = "plainValue" )
106106 @ InjectMojo (goal = "test:test-plugin:0.0.1-SNAPSHOT:parameters" , pom = EXPLICIT_POM_DIR + POM_DOT_XML_FILE )
107107 void simpleMojoWithParameterInjectionWinsOverConfig (ParametersMojo mojo ) {
108- assertEquals ("plainValue" , mojo .plain );
108+ assertEquals ("plainValue" , mojo .getPlain () );
109109 assertDoesNotThrow (mojo ::execute );
110110 }
111111
112112 @ Test
113113 @ Basedir ("src/test/projects/basedir-set-by-annotation" )
114114 @ InjectMojo (goal = "test:test-plugin:0.0.1-SNAPSHOT:parameters" , pom = POM_DOT_XML_FILE )
115115 void basedirInjectedWithBasedirAnnotation (ParametersMojo mojo ) {
116- assertEquals ("i-have-a-basedir-set-by-annotation" , mojo .plain );
116+ assertEquals ("i-have-a-basedir-set-by-annotation" , mojo .getPlain () );
117117 assertDoesNotThrow (mojo ::execute );
118118 }
119119}
0 commit comments