This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-release-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 33586a4  Partial port to JUnit 5
33586a4 is described below

commit 33586a4fdddb88a1f0373d7b32c4cfd3c7ec404e
Author: Gary Gregory <[email protected]>
AuthorDate: Thu Jan 1 16:23:20 2026 -0500

    Partial port to JUnit 5
---
 pom.xml                                            |  5 +++
 src/changes/changes.xml                            |  1 +
 .../plugin/mojos/CommonsSiteCompressionMojo.java   |  2 +-
 .../CommonsDistributionDetachmentMojoTest.java     | 41 +++++-------------
 .../mojos/CommonsSiteCompressionMojoTest.java      | 48 ++++++----------------
 .../mojos/CommonsStagingCleanupMojoTest.java       | 34 ++++-----------
 .../velocity/HeaderHtmlVelocityDelegateTest.java   |  8 ++--
 .../velocity/ReadmeHtmlVelocityDelegateTest.java   | 12 +++---
 8 files changed, 47 insertions(+), 104 deletions(-)

diff --git a/pom.xml b/pom.xml
index 2d053c7..5a42b88 100644
--- a/pom.xml
+++ b/pom.xml
@@ -171,6 +171,11 @@
       <version>${maven.dependency.version}</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter</artifactId>
+      <scope>test</scope>
+    </dependency>
     <dependency>
       <groupId>org.junit.vintage</groupId>
       <artifactId>junit-vintage-engine</artifactId>
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 35b0312..68f4aac 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -29,6 +29,7 @@
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix Apache RAT 
plugin console warnings.</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Make some 
classes final.</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix missing 
version for org.codehaus.mojo:jdepend-maven-plugin: 2.1.</action>
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">Partial port to 
JUnit 5.</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Bump 
org.apache.maven:maven-artifact from 3.9.11 to 3.9.12.</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Bump 
org.apache.maven:maven-compat from 3.9.11 to 3.9.12.</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Bump 
org.apache.maven:maven-core from 3.9.11 to 3.9.12.</action>
diff --git 
a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojo.java
 
b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojo.java
index bcb7016..e50907e 100644
--- 
a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojo.java
+++ 
b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojo.java
@@ -40,7 +40,7 @@ import org.apache.maven.plugins.annotations.Parameter;
  * <code>./target/commons-release-plugin/site.zip</code>.
  *
  * @since 1.0
- * @deprecated - as we no longer wish to compress the site, we are going to 
put this functionality in the
+ * @deprecated As we no longer wish to compress the site, we are going to put 
this functionality in the
  *               {@link CommonsDistributionStagingMojo}.
  */
 @Deprecated
diff --git 
a/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojoTest.java
 
b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojoTest.java
index 20ef38a..81002ec 100644
--- 
a/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojoTest.java
+++ 
b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojoTest.java
@@ -18,39 +18,24 @@ package org.apache.commons.release.plugin.mojos;
 
 import static junit.framework.TestCase.assertTrue;
 import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
 
 import java.io.File;
 
-import org.apache.maven.plugin.testing.MojoRule;
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoTest;
 import org.codehaus.plexus.util.FileUtils;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 /**
  * Unit tests for {@link CommonsDistributionDetachmentMojo}.
  */
+@MojoTest
 public class CommonsDistributionDetachmentMojoTest {
 
     private static final String COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH = 
"target/testing-commons-release-plugin";
 
-    @Rule
-    public final MojoRule rule = new MojoRule() {
-        @Override
-        protected void after() {
-            // noop
-        }
-
-        @Override
-        protected void before() throws Throwable {
-            // noop
-        }
-    };
-
-    private CommonsDistributionDetachmentMojo mojo;
-
-    @Before
+    @BeforeEach
     public void setUp() throws Exception {
         final File testingDirectory = new 
File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH);
         if (testingDirectory.exists()) {
@@ -59,22 +44,16 @@ public class CommonsDistributionDetachmentMojoTest {
     }
 
     @Test
-    public void testDisabled() throws Exception {
-        final File testPom = new 
File("src/test/resources/mojos/detach-distributions/detach-distributions-disabled.xml");
-        assertNotNull(testPom);
-        assertTrue(testPom.exists());
-        mojo = (CommonsDistributionDetachmentMojo) 
rule.lookupMojo("detach-distributions", testPom);
+    @InjectMojo(goal = "detach-distributions", pom = 
"src/test/resources/mojos/detach-distributions/detach-distributions-disabled.xml")
+    public void testDisabled(final CommonsDistributionDetachmentMojo mojo) 
throws Exception {
         mojo.execute();
         final File testingDirectory = new 
File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH);
         assertFalse(testingDirectory.exists());
     }
 
     @Test
-    public void testSuccess() throws Exception {
-        final File testPom = new 
File("src/test/resources/mojos/detach-distributions/detach-distributions.xml");
-        assertNotNull(testPom);
-        assertTrue(testPom.exists());
-        mojo = (CommonsDistributionDetachmentMojo) 
rule.lookupMojo("detach-distributions", testPom);
+    @InjectMojo(goal = "detach-distributions", pom = 
"src/test/resources/mojos/detach-distributions/detach-distributions.xml")
+    public void testSuccess(final CommonsDistributionDetachmentMojo mojo) 
throws Exception {
         mojo.execute();
         final File detachedSrcTarGz = new 
File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/commons-text-1.4-src.tar.gz");
         final File detachedSrcTarGzAsc = new 
File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/commons-text-1.4-src.tar.gz.asc");
diff --git 
a/src/test/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojoTest.java
 
b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojoTest.java
index df495b7..46532e3 100644
--- 
a/src/test/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojoTest.java
+++ 
b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojoTest.java
@@ -19,41 +19,26 @@ package org.apache.commons.release.plugin.mojos;
 import static junit.framework.TestCase.assertTrue;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
 
 import java.io.File;
 
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoTest;
 import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.testing.MojoRule;
 import org.codehaus.plexus.util.FileUtils;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 /**
  * Unit tests for {@link CommonsSiteCompressionMojo}.
  */
 @SuppressWarnings("deprecation") // testing a deprecated class
+@MojoTest
 public class CommonsSiteCompressionMojoTest {
 
     private static final String COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH = 
"target/testing-commons-release-plugin";
 
-    @Rule
-    public final MojoRule rule = new MojoRule() {
-        @Override
-        protected void after() {
-            // noop
-        }
-
-        @Override
-        protected void before() throws Throwable {
-            // noop
-        }
-    };
-
-    protected CommonsSiteCompressionMojo mojo;
-
-    @Before
+    @BeforeEach
     public void setUp() throws Exception {
         final File testingDirectory = new 
File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH);
         if (testingDirectory.exists()) {
@@ -62,11 +47,8 @@ public class CommonsSiteCompressionMojoTest {
     }
 
     @Test
-    public void testCompressSiteDirNonExistentFailure() throws Exception {
-        final File testPom = new 
File("src/test/resources/mojos/compress-site/compress-site-failure.xml");
-        assertNotNull(testPom);
-        assertTrue(testPom.exists());
-        mojo = (CommonsSiteCompressionMojo) rule.lookupMojo("compress-site", 
testPom);
+    @InjectMojo(goal = "compress-site", pom = 
"src/test/resources/mojos/compress-site/compress-site-failure.xml")
+    public void testCompressSiteDirNonExistentFailure(final 
CommonsSiteCompressionMojo mojo) throws Exception {
         try {
             mojo.execute();
         } catch (final MojoFailureException e) {
@@ -77,24 +59,18 @@ public class CommonsSiteCompressionMojoTest {
     }
 
     @Test
-    public void testCompressSiteSuccess() throws Exception {
+    @InjectMojo(goal = "compress-site", pom = 
"src/test/resources/mojos/compress-site/compress-site.xml")
+    public void testCompressSiteSuccess(final CommonsSiteCompressionMojo mojo) 
throws Exception {
         final File testingDirectory = new 
File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH);
         testingDirectory.mkdir();
-        final File testPom = new 
File("src/test/resources/mojos/compress-site/compress-site.xml");
-        assertNotNull(testPom);
-        assertTrue(testPom.exists());
-        mojo = (CommonsSiteCompressionMojo) rule.lookupMojo("compress-site", 
testPom);
         mojo.execute();
         final File siteZip = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + 
"/site.zip");
         assertTrue(siteZip.exists());
     }
 
     @Test
-    public void testDisabled() throws Exception {
-        final File testPom = new 
File("src/test/resources/mojos/compress-site/compress-site-disabled.xml");
-        assertNotNull(testPom);
-        assertTrue(testPom.exists());
-        mojo = (CommonsSiteCompressionMojo) rule.lookupMojo("compress-site", 
testPom);
+    @InjectMojo(goal = "compress-site", pom = 
"src/test/resources/mojos/compress-site/compress-site-disabled.xml")
+    public void testDisabled(final CommonsSiteCompressionMojo mojo) throws 
Exception {
         mojo.execute();
         final File testingDirectory = new 
File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH);
         assertFalse(testingDirectory.exists());
diff --git 
a/src/test/java/org/apache/commons/release/plugin/mojos/CommonsStagingCleanupMojoTest.java
 
b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsStagingCleanupMojoTest.java
index 8909373..391744e 100644
--- 
a/src/test/java/org/apache/commons/release/plugin/mojos/CommonsStagingCleanupMojoTest.java
+++ 
b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsStagingCleanupMojoTest.java
@@ -17,39 +17,24 @@
 package org.apache.commons.release.plugin.mojos;
 
 import static junit.framework.TestCase.assertTrue;
-import static org.junit.Assert.assertNotNull;
 
 import java.io.File;
 
-import org.apache.maven.plugin.testing.MojoRule;
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoTest;
 import org.codehaus.plexus.util.FileUtils;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 /**
  * Unit tests for {@link CommonsSiteCompressionMojo}.
  */
+@MojoTest
 public class CommonsStagingCleanupMojoTest {
 
     private static final String COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH = 
"target/testing-commons-release-plugin";
 
-    @Rule
-    public final MojoRule rule = new MojoRule() {
-        @Override
-        protected void after() {
-            // noop
-        }
-
-        @Override
-        protected void before() throws Throwable {
-            // noop
-        }
-    };
-
-    protected CommonsStagingCleanupMojo mojo;
-
-    @Before
+    @BeforeEach
     public void setUp() throws Exception {
         final File testingDirectory = new 
File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH);
         if (testingDirectory.exists()) {
@@ -58,13 +43,10 @@ public class CommonsStagingCleanupMojoTest {
     }
 
     @Test
-    public void testCompressSiteSuccess() throws Exception {
+    @InjectMojo(goal = "clean-staging", pom = 
"src/test/resources/mojos/staging-cleanup/staging-cleanup.xml")
+    public void testCompressSiteSuccess(final CommonsStagingCleanupMojo mojo) 
throws Exception {
         final File testingDirectory = new 
File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH);
         testingDirectory.mkdir();
-        final File testPom = new 
File("src/test/resources/mojos/staging-cleanup/staging-cleanup.xml");
-        assertNotNull(testPom);
-        assertTrue(testPom.exists());
-        mojo = (CommonsStagingCleanupMojo) rule.lookupMojo("clean-staging", 
testPom);
         mojo.execute();
         final File cleanupDir = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH 
+ "/scm-cleanup");
         assertTrue(cleanupDir.exists());
diff --git 
a/src/test/java/org/apache/commons/release/plugin/velocity/HeaderHtmlVelocityDelegateTest.java
 
b/src/test/java/org/apache/commons/release/plugin/velocity/HeaderHtmlVelocityDelegateTest.java
index 403a051..a3a9096 100644
--- 
a/src/test/java/org/apache/commons/release/plugin/velocity/HeaderHtmlVelocityDelegateTest.java
+++ 
b/src/test/java/org/apache/commons/release/plugin/velocity/HeaderHtmlVelocityDelegateTest.java
@@ -16,21 +16,21 @@
  */
 package org.apache.commons.release.plugin.velocity;
 
-import static junit.framework.TestCase.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.io.IOException;
 import java.io.StringWriter;
 import java.io.Writer;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 /**
  * Unit tests for {@link HeaderHtmlVelocityDelegate}.
  */
-public class HeaderHtmlVelocityDelegateTest {
+class HeaderHtmlVelocityDelegateTest {
 
     @Test
-    public void testSuccess() throws IOException {
+    void testSuccess() throws IOException {
         final HeaderHtmlVelocityDelegate subject = 
HeaderHtmlVelocityDelegate.builder().build();
         try (Writer writer = subject.render(new StringWriter())) {
             assertTrue(writer.toString().contains("<h2>Apache Commons Project 
Distributions</h2>"));
diff --git 
a/src/test/java/org/apache/commons/release/plugin/velocity/ReadmeHtmlVelocityDelegateTest.java
 
b/src/test/java/org/apache/commons/release/plugin/velocity/ReadmeHtmlVelocityDelegateTest.java
index b2009e2..c82d156 100644
--- 
a/src/test/java/org/apache/commons/release/plugin/velocity/ReadmeHtmlVelocityDelegateTest.java
+++ 
b/src/test/java/org/apache/commons/release/plugin/velocity/ReadmeHtmlVelocityDelegateTest.java
@@ -16,21 +16,21 @@
  */
 package org.apache.commons.release.plugin.velocity;
 
-import static junit.framework.TestCase.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.io.IOException;
 import java.io.StringWriter;
 import java.io.Writer;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 /**
  * Unit tests for {@link ReadmeHtmlVelocityDelegate}.
  */
-public final class ReadmeHtmlVelocityDelegateTest {
+final class ReadmeHtmlVelocityDelegateTest {
 
     @Test
-    public void testSuccessfulRun() throws IOException {
+    void testSuccessfulRun() throws IOException {
         final ReadmeHtmlVelocityDelegate delegate = 
ReadmeHtmlVelocityDelegate.builder()
                 .withArtifactId("commons-text")
                 .withVersion("1.4")
@@ -43,7 +43,7 @@ public final class ReadmeHtmlVelocityDelegateTest {
     }
 
     @Test
-    public void testSuccessfulRunBcel() throws IOException {
+    void testSuccessfulRunBcel() throws IOException {
         final ReadmeHtmlVelocityDelegate delegate = 
ReadmeHtmlVelocityDelegate.builder()
                 .withArtifactId("bcel")
                 .withVersion("1.5")
@@ -56,7 +56,7 @@ public final class ReadmeHtmlVelocityDelegateTest {
     }
 
     @Test
-    public void testSuccessfulRunLang3() throws IOException {
+    void testSuccessfulRunLang3() throws IOException {
         final ReadmeHtmlVelocityDelegate delegate = 
ReadmeHtmlVelocityDelegate.builder()
                 .withArtifactId("commons-lang3")
                 .withVersion("3.8.1")

Reply via email to