This is an automated email from the ASF dual-hosted git repository. slachiewicz pushed a commit to branch maven-plugin-testing-3.x in repository https://gitbox.apache.org/repos/asf/maven-plugin-testing.git
commit a5c08c8b876240f31b3ec657b0b430c2a7b9b2bf Author: Sylwester Lachiewicz <slachiew...@apache.org> AuthorDate: Thu Jun 5 20:02:43 2025 +0200 Cleanup to remove issues --- maven-plugin-testing-harness/pom.xml | 13 +------ .../maven/plugin/testing/ParametersMojo.java | 45 ++++++++++++++++++---- .../maven/plugin/testing/ParametersMojoTest.java | 32 +++++++-------- .../maven/plugin/testing/junit5/Junit5Test.java | 6 +-- .../testing/resources/TestResourcesTest.java | 3 +- pom.xml | 4 +- 6 files changed, 62 insertions(+), 41 deletions(-) diff --git a/maven-plugin-testing-harness/pom.xml b/maven-plugin-testing-harness/pom.xml index 3d9a9b4..5ddc46d 100644 --- a/maven-plugin-testing-harness/pom.xml +++ b/maven-plugin-testing-harness/pom.xml @@ -31,21 +31,10 @@ under the License. <description>The Maven Plugin Testing Harness provides mechanisms to manage tests on Mojo.</description> <properties> + <versions.junit5>5.13.0</versions.junit5> <wagonVersion>3.5.3</wagonVersion> </properties> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.junit</groupId> - <artifactId>junit-bom</artifactId> - <version>5.13.0</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <dependencies> <!-- maven --> <dependency> diff --git a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ParametersMojo.java b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ParametersMojo.java index 77e52d9..438b46f 100644 --- a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ParametersMojo.java +++ b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ParametersMojo.java @@ -19,20 +19,51 @@ package org.apache.maven.plugin.testing; import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; public class ParametersMojo extends AbstractMojo { - public String plain; - public String withProperty; + private String plain; - public String withDefault; + private String withProperty; - public String withPropertyAndDefault; + private String withDefault; + + private String withPropertyAndDefault; @Override - public void execute() throws MojoExecutionException, MojoFailureException { + public void execute() { getLog().info("Plain value = " + plain); } + + public String getPlain() { + return plain; + } + + public void setPlain(String plain) { + this.plain = plain; + } + + public String getWithProperty() { + return withProperty; + } + + public void setWithProperty(String withProperty) { + this.withProperty = withProperty; + } + + public String getWithDefault() { + return withDefault; + } + + public void setWithDefault(String withDefault) { + this.withDefault = withDefault; + } + + public String getWithPropertyAndDefault() { + return withPropertyAndDefault; + } + + public void setWithPropertyAndDefault(String withPropertyAndDefault) { + this.withPropertyAndDefault = withPropertyAndDefault; + } } diff --git a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ParametersMojoTest.java b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ParametersMojoTest.java index ce7869c..90cb4df 100644 --- a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ParametersMojoTest.java +++ b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ParametersMojoTest.java @@ -36,10 +36,10 @@ public class ParametersMojoTest extends AbstractMojoTestCase { ParametersMojo mojo = (ParametersMojo) lookupConfiguredMojo(project, "parameters"); - assertNull(mojo.plain); - assertNull(mojo.withProperty); - assertEquals("default", mojo.withDefault); - assertEquals("default", mojo.withPropertyAndDefault); + assertNull(mojo.getPlain()); + assertNull(mojo.getWithProperty()); + assertEquals("default", mojo.getWithDefault()); + assertEquals("default", mojo.getWithPropertyAndDefault()); } public void testExplicit() throws Exception { @@ -47,10 +47,10 @@ public class ParametersMojoTest extends AbstractMojoTestCase { ParametersMojo mojo = (ParametersMojo) lookupConfiguredMojo(project, "parameters"); - assertEquals("explicitValue", mojo.plain); - assertEquals("explicitWithPropertyValue", mojo.withProperty); - assertEquals("explicitWithDefaultValue", mojo.withDefault); - assertEquals("explicitWithPropertyAndDefaultValue", mojo.withPropertyAndDefault); + assertEquals("explicitValue", mojo.getPlain()); + assertEquals("explicitWithPropertyValue", mojo.getWithProperty()); + assertEquals("explicitWithDefaultValue", mojo.getWithDefault()); + assertEquals("explicitWithPropertyAndDefaultValue", mojo.getWithPropertyAndDefault()); } public void testDefaultWithProperty() throws Exception { @@ -61,10 +61,10 @@ public class ParametersMojoTest extends AbstractMojoTestCase { session.getUserProperties().put("property", "propertyValue"); ParametersMojo mojo = (ParametersMojo) lookupConfiguredMojo(session, execution); - assertNull(mojo.plain); - assertEquals("propertyValue", mojo.withProperty); - assertEquals("default", mojo.withDefault); - assertEquals("propertyValue", mojo.withPropertyAndDefault); + assertNull(mojo.getPlain()); + assertEquals("propertyValue", mojo.getWithProperty()); + assertEquals("default", mojo.getWithDefault()); + assertEquals("propertyValue", mojo.getWithPropertyAndDefault()); } public void testExplicitWithProperty() throws Exception { @@ -75,10 +75,10 @@ public class ParametersMojoTest extends AbstractMojoTestCase { session.getUserProperties().put("property", "propertyValue"); ParametersMojo mojo = (ParametersMojo) lookupConfiguredMojo(session, execution); - assertEquals("explicitValue", mojo.plain); - assertEquals("explicitWithPropertyValue", mojo.withProperty); - assertEquals("explicitWithDefaultValue", mojo.withDefault); - assertEquals("explicitWithPropertyAndDefaultValue", mojo.withPropertyAndDefault); + assertEquals("explicitValue", mojo.getPlain()); + assertEquals("explicitWithPropertyValue", mojo.getWithProperty()); + assertEquals("explicitWithDefaultValue", mojo.getWithDefault()); + assertEquals("explicitWithPropertyAndDefaultValue", mojo.getWithPropertyAndDefault()); } protected MavenProject readMavenProject(File basedir) throws ProjectBuildingException, Exception { diff --git a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/junit5/Junit5Test.java b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/junit5/Junit5Test.java index 9da0036..caab8f4 100644 --- a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/junit5/Junit5Test.java +++ b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/junit5/Junit5Test.java @@ -56,8 +56,8 @@ class Junit5Test { @MojoParameter(name = "plain", value = "plainValue") @MojoParameter(name = "withDefault", value = "withDefaultValue") void simpleMojoWithParameters(ParametersMojo mojo) { - assertEquals("plainValue", mojo.plain); - assertEquals("withDefaultValue", mojo.withDefault); + assertEquals("plainValue", mojo.getPlain()); + assertEquals("withDefaultValue", mojo.getWithDefault()); assertDoesNotThrow(mojo::execute); } @@ -65,7 +65,7 @@ class Junit5Test { @InjectMojo(goal = "test:test-plugin:0.0.1-SNAPSHOT:parameters", pom = POM) @MojoParameter(name = "plain", value = "plainValue") void simpleMojoWithParameter(ParametersMojo mojo) { - assertEquals("plainValue", mojo.plain); + assertEquals("plainValue", mojo.getPlain()); assertDoesNotThrow(mojo::execute); } } diff --git a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/resources/TestResourcesTest.java b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/resources/TestResourcesTest.java index 8ce1ecb..9863763 100644 --- a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/resources/TestResourcesTest.java +++ b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/resources/TestResourcesTest.java @@ -21,7 +21,8 @@ package org.apache.maven.plugin.testing.resources; import org.junit.Test; public class TestResourcesTest { - public TestResources resources = new TestResources(); + + private final TestResources resources = new TestResources(); @Test(expected = IllegalStateException.class) public void testNoRuleAnnotation() throws Exception { diff --git a/pom.xml b/pom.xml index 5e6cfde..6a4bfca 100644 --- a/pom.xml +++ b/pom.xml @@ -49,8 +49,8 @@ under the License. <url>https://github.com/apache/maven-plugin-testing/tree/${project.scm.tag}</url> </scm> <issueManagement> - <system>jira</system> - <url>https://issues.apache.org/jira/browse/MPLUGINTESTING</url> + <system>GitHub</system> + <url>https://github.com/apache/maven-plugin-testing/issues</url> </issueManagement> <ciManagement> <system>Jenkins</system>