You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2024/12/24 23:18:13 UTC

(maven-jxr) branch master updated: [JXR-195] Convert tests to JUnit 5

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

slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-jxr.git


The following commit(s) were added to refs/heads/master by this push:
     new 6ea48c6  [JXR-195] Convert tests to JUnit 5
6ea48c6 is described below

commit 6ea48c6e9e1dc1e1300017125b53eb0aeae2ae92
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Tue Dec 24 15:27:28 2024 +0100

    [JXR-195] Convert tests to JUnit 5
---
 maven-jxr-plugin/pom.xml                           | 17 ++++-
 .../maven/plugin/jxr/AbstractJxrTestCase.java      | 12 ++--
 .../org/apache/maven/plugin/jxr/JxrReportTest.java | 72 ++++++++++------------
 .../apache/maven/plugin/jxr/JxrTestReportTest.java | 12 ++--
 .../jxr/stubs/AggregateTestMavenProjectStub.java   |  4 +-
 .../DefaultConfigurationMavenProjectStub.java      |  4 +-
 .../ExcludeConfigurationMavenProjectStub.java      |  4 +-
 .../IncludeConfigurationMavenProjectStub.java      |  4 +-
 .../jxr/stubs/NoJavadocDirMavenProjectStub.java    |  6 +-
 ...NoJavadocLinkConfigurationMavenProjectStub.java |  4 +-
 .../plugin/jxr/stubs/PomMavenProjectStub.java      |  4 +-
 .../jxr/stubs/TestSourceDirMavenProjectStub.java   |  4 +-
 maven-jxr/pom.xml                                  |  6 +-
 .../org/apache/maven/jxr/DirectoryIndexerTest.java | 16 ++---
 .../org/apache/maven/jxr/IncludeExcludeTest.java   | 32 ++++------
 .../test/java/org/apache/maven/jxr/JXR141Test.java | 18 +++---
 .../apache/maven/jxr/JavaCodeTransformTest.java    | 23 ++++---
 .../java/org/apache/maven/jxr/JxrBeanTest.java     | 12 ++--
 .../apache/maven/jxr/pacman/JavaFileImplTest.java  | 12 ++--
 .../maven/jxr/util/SimpleWordTokenizerTest.java    | 16 ++---
 pom.xml                                            |  5 --
 21 files changed, 145 insertions(+), 142 deletions(-)

diff --git a/maven-jxr-plugin/pom.xml b/maven-jxr-plugin/pom.xml
index a934ec9..de77483 100644
--- a/maven-jxr-plugin/pom.xml
+++ b/maven-jxr-plugin/pom.xml
@@ -161,8 +161,19 @@ under the License.
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-api</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.junit.vintage</groupId>
+      <artifactId>junit-vintage-engine</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
       <scope>test</scope>
     </dependency>
   </dependencies>
@@ -209,7 +220,7 @@ under the License.
             </goals>
             <configuration>
               <failOnWarning>true</failOnWarning>
-              <ignoredDependencies>junit:junit:*,org.apache.maven:maven-compat:*,org.apache.maven.resolver:maven-resolver-connector-basic:*,org.apache.maven.resolver:maven-resolver-transport-wagon:*,org.apache.maven.wagon:wagon-http-lightweight:*</ignoredDependencies>
+              <ignoredDependencies>org.apache.maven:maven-compat:*,org.apache.maven.resolver:maven-resolver-connector-basic:*,org.apache.maven.resolver:maven-resolver-transport-wagon:*,org.apache.maven.wagon:wagon-http-lightweight:*,org.junit.vintage:*,org.slf4j:slf4j-simple</ignoredDependencies>
             </configuration>
           </execution>
         </executions>
diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/AbstractJxrTestCase.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/AbstractJxrTestCase.java
index d249460..c7a7c6a 100644
--- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/AbstractJxrTestCase.java
+++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/AbstractJxrTestCase.java
@@ -39,6 +39,10 @@ import org.apache.maven.project.ProjectBuildingRequest;
 import org.eclipse.aether.DefaultRepositorySystemSession;
 import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory;
 import org.eclipse.aether.repository.LocalRepository;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 
 /**
  * Abstract class to test reports generation.
@@ -51,8 +55,8 @@ public abstract class AbstractJxrTestCase extends AbstractMojoTestCase {
      */
     private MavenProject testMavenProject;
 
-    @Override
-    protected void setUp() throws Exception {
+    @BeforeEach
+    public void setUp() throws Exception {
         // required for mojo lookups to work
         super.setUp();
 
@@ -60,8 +64,8 @@ public abstract class AbstractJxrTestCase extends AbstractMojoTestCase {
         artifactStubFactory.getWorkingDir().mkdirs();
     }
 
-    @Override
-    protected void tearDown() throws Exception {
+    @AfterEach
+    public void tearDown() throws Exception {
         super.tearDown();
     }
 
diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/JxrReportTest.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/JxrReportTest.java
index 268328d..b7aa189 100644
--- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/JxrReportTest.java
+++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/JxrReportTest.java
@@ -24,18 +24,23 @@ import java.nio.file.Path;
 import java.util.Locale;
 
 import org.codehaus.plexus.util.FileUtils;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 /**
  * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
  * @author <a href="mailto:dennisl@apache.org">Dennis Lundberg</a>
  */
-public class JxrReportTest extends AbstractJxrTestCase {
+class JxrReportTest extends AbstractJxrTestCase {
     /**
      * Test the plugin with original configuration
-     *
-     * @throws Exception
      */
-    public void testDefaultConfiguration() throws Exception {
+    @Test
+    void defaultConfiguration() throws Exception {
         File resourcesDir = new File(getBasedir(), "src/test/resources/unit/default-configuration");
 
         File outputDir = new File(getBasedir(), "target/test/unit/default-configuration/target/site");
@@ -69,10 +74,9 @@ public class JxrReportTest extends AbstractJxrTestCase {
 
     /**
      * Test the plugin with jdk-4 configuration
-     *
-     * @throws Exception
      */
-    public void testJdk4Configuration() throws Exception {
+    @Test
+    void jdk4Configuration() throws Exception {
         File resourcesDir = new File(getBasedir(), "src/test/resources/unit/default-configuration");
 
         File outputDir = new File(getBasedir(), "target/test/unit/default-configuration/target/site/4");
@@ -106,10 +110,9 @@ public class JxrReportTest extends AbstractJxrTestCase {
 
     /**
      * Test the plugin with jdk-6 configuration
-     *
-     * @throws Exception
      */
-    public void testJdk6Configuration() throws Exception {
+    @Test
+    void jdk6Configuration() throws Exception {
         File resourcesDir = new File(getBasedir(), "src/test/resources/unit/default-configuration");
 
         File outputDir = new File(getBasedir(), "target/test/unit/default-configuration/target/site/6");
@@ -143,10 +146,9 @@ public class JxrReportTest extends AbstractJxrTestCase {
 
     /**
      * Test the plugin with jdk-7 configuration
-     *
-     * @throws Exception
      */
-    public void testJdk7Configuration() throws Exception {
+    @Test
+    void jdk7Configuration() throws Exception {
         File resourcesDir = new File(getBasedir(), "src/test/resources/unit/default-configuration");
 
         File outputDir = new File(getBasedir(), "target/test/unit/default-configuration/target/site/7");
@@ -184,10 +186,9 @@ public class JxrReportTest extends AbstractJxrTestCase {
 
     /**
      * Test the plugin with jdk-8 configuration
-     *
-     * @throws Exception
      */
-    public void testJdk8Configuration() throws Exception {
+    @Test
+    void jdk8Configuration() throws Exception {
         File resourcesDir = new File(getBasedir(), "src/test/resources/unit/default-configuration");
 
         File outputDir = new File(getBasedir(), "target/test/unit/default-configuration/target/site/8");
@@ -221,10 +222,9 @@ public class JxrReportTest extends AbstractJxrTestCase {
 
     /**
      * Test when javadocLink is disabled in the configuration
-     *
-     * @throws Exception
      */
-    public void testNoJavadocLink() throws Exception {
+    @Test
+    void noJavadocLink() throws Exception {
         generateReport(getGoal(), "nojavadoclink-configuration/nojavadoclink-configuration-plugin-config.xml");
 
         File xrefDir = new File(getBasedir(), "target/test/unit/nojavadoclink-configuration/target/site/xref");
@@ -246,13 +246,13 @@ public class JxrReportTest extends AbstractJxrTestCase {
         // check if there's a link to the javadoc files
         String str = readFile(xrefDir, "nojavadoclink/configuration/AppSample.html");
         assertEquals(
-                str.toLowerCase(Locale.ENGLISH).indexOf("/apidocs/nojavadoclink/configuration/appsample.html\""), -1);
+                -1, str.toLowerCase(Locale.ENGLISH).indexOf("/apidocs/nojavadoclink/configuration/appsample.html\""));
 
         str = readFile(xrefDir, "nojavadoclink/configuration/App.html");
-        assertEquals(str.toLowerCase(Locale.ENGLISH).indexOf("/apidocs/nojavadoclink/configuration/app.html\""), -1);
+        assertEquals(-1, str.toLowerCase(Locale.ENGLISH).indexOf("/apidocs/nojavadoclink/configuration/app.html\""));
 
         str = readFile(xrefDir, "nojavadoclink/configuration/sample/Sample.html");
-        assertEquals(str.toLowerCase().indexOf("/apidocs/nojavadoclink/configuration/sample/sample.html\""), -1);
+        assertEquals(-1, str.toLowerCase().indexOf("/apidocs/nojavadoclink/configuration/sample/sample.html\""));
 
         // check if encoding is ISO-8859-1, like specified in the plugin configuration
         assertTrue(str.contains("text/html; charset=ISO-8859-1"));
@@ -260,10 +260,9 @@ public class JxrReportTest extends AbstractJxrTestCase {
 
     /**
      * Method for testing plugin when aggregate parameter is set to true
-     *
-     * @throws Exception
      */
-    public void testAggregate() throws Exception {
+    @Test
+    void aggregate() throws Exception {
         generateReport(getGoal(), "aggregate-test/aggregate-test-plugin-config.xml");
 
         File xrefDir = new File(getBasedir(), "target/test/unit/aggregate-test/target/site/xref");
@@ -283,10 +282,9 @@ public class JxrReportTest extends AbstractJxrTestCase {
 
     /**
      * Method for testing plugin when the specified javadocDir does not exist
-     *
-     * @throws Exception
      */
-    public void testNoJavadocDir() throws Exception {
+    @Test
+    void noJavadocDir() throws Exception {
         generateReport(getGoal(), "nojavadocdir-test/nojavadocdir-test-plugin-config.xml");
 
         File xrefDir = new File(getBasedir(), "target/test/unit/nojavadocdir-test/target/site/xref");
@@ -301,10 +299,9 @@ public class JxrReportTest extends AbstractJxrTestCase {
 
     /**
      * Test the plugin with an exclude configuration.
-     *
-     * @throws Exception
      */
-    public void testExclude() throws Exception {
+    @Test
+    void exclude() throws Exception {
         generateReport(getGoal(), "exclude-configuration/exclude-configuration-plugin-config.xml");
 
         Path xrefDir = new File(getBasedir(), "target/test/unit/exclude-configuration/target/site/xref").toPath();
@@ -318,10 +315,9 @@ public class JxrReportTest extends AbstractJxrTestCase {
 
     /**
      * Test the plugin with an include configuration.
-     *
-     * @throws Exception
      */
-    public void testInclude() throws Exception {
+    @Test
+    void include() throws Exception {
         generateReport(getGoal(), "include-configuration/include-configuration-plugin-config.xml");
 
         Path xrefDir = new File(getBasedir(), "target/test/unit/include-configuration/target/site/xref").toPath();
@@ -333,7 +329,8 @@ public class JxrReportTest extends AbstractJxrTestCase {
         assertFalse(Files.exists(xrefDir.resolve("include/configuration/AppSample.html")));
     }
 
-    public void testExceptions() {
+    @Test
+    void exceptions() {
         try {
             generateReport(getGoal(), "default-configuration/exception-test-plugin-config.xml");
 
@@ -345,10 +342,9 @@ public class JxrReportTest extends AbstractJxrTestCase {
 
     /**
      * Test the jxr for a POM project.
-     *
-     * @throws Exception
      */
-    public void testPom() throws Exception {
+    @Test
+    void pom() throws Exception {
         generateReport(getGoal(), "pom-test/pom-test-plugin-config.xml");
 
         assertFalse(new File(getBasedir(), "target/test/unit/pom-test").exists());
diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/JxrTestReportTest.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/JxrTestReportTest.java
index 921c582..350ab1c 100644
--- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/JxrTestReportTest.java
+++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/JxrTestReportTest.java
@@ -20,16 +20,20 @@ package org.apache.maven.plugin.jxr;
 
 import java.io.File;
 
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
 /**
  * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
  */
-public class JxrTestReportTest extends AbstractJxrTestCase {
+class JxrTestReportTest extends AbstractJxrTestCase {
     /**
      * Method to test when the source dir is the test source dir
-     *
-     * @throws Exception
      */
-    public void testSourceDir() throws Exception {
+    @Test
+    void sourceDir() throws Exception {
         generateReport(getGoal(), "testsourcedir-test/testsourcedir-test-plugin-config.xml");
 
         File xrefTestDir = new File(getBasedir(), "target/test/unit/testsourcedir-test/target/site/xref-test");
diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/AggregateTestMavenProjectStub.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/AggregateTestMavenProjectStub.java
index 9c7e1fa..e0bff73 100644
--- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/AggregateTestMavenProjectStub.java
+++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/AggregateTestMavenProjectStub.java
@@ -19,8 +19,8 @@
 package org.apache.maven.plugin.jxr.stubs;
 
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.InputStream;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -39,7 +39,7 @@ public class AggregateTestMavenProjectStub extends JxrProjectStub {
         MavenXpp3Reader pomReader = new MavenXpp3Reader();
         Model model = null;
 
-        try (InputStream is = new FileInputStream(new File(getBasedir() + "/" + getPOM()))) {
+        try (InputStream is = Files.newInputStream(new File(getBasedir() + "/" + getPOM()).toPath())) {
             model = pomReader.read(is);
             setModel(model);
         } catch (Exception ignored) {
diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/DefaultConfigurationMavenProjectStub.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/DefaultConfigurationMavenProjectStub.java
index eab947e..894a062 100644
--- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/DefaultConfigurationMavenProjectStub.java
+++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/DefaultConfigurationMavenProjectStub.java
@@ -19,8 +19,8 @@
 package org.apache.maven.plugin.jxr.stubs;
 
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.InputStream;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -39,7 +39,7 @@ public class DefaultConfigurationMavenProjectStub extends JxrProjectStub {
         MavenXpp3Reader pomReader = new MavenXpp3Reader();
         Model model = null;
 
-        try (InputStream is = new FileInputStream(new File(getBasedir() + "/" + getPOM()))) {
+        try (InputStream is = Files.newInputStream(new File(getBasedir() + "/" + getPOM()).toPath())) {
             model = pomReader.read(is);
             setModel(model);
         } catch (Exception ignored) {
diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/ExcludeConfigurationMavenProjectStub.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/ExcludeConfigurationMavenProjectStub.java
index 4ce55f7..2572ee6 100644
--- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/ExcludeConfigurationMavenProjectStub.java
+++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/ExcludeConfigurationMavenProjectStub.java
@@ -19,8 +19,8 @@
 package org.apache.maven.plugin.jxr.stubs;
 
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.InputStream;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -39,7 +39,7 @@ public class ExcludeConfigurationMavenProjectStub extends JxrProjectStub {
         MavenXpp3Reader pomReader = new MavenXpp3Reader();
         Model model = null;
 
-        try (InputStream is = new FileInputStream(new File(getBasedir() + "/" + getPOM()))) {
+        try (InputStream is = Files.newInputStream(new File(getBasedir() + "/" + getPOM()).toPath())) {
             model = pomReader.read(is);
             setModel(model);
         } catch (Exception ignored) {
diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/IncludeConfigurationMavenProjectStub.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/IncludeConfigurationMavenProjectStub.java
index 617f6fa..4c0019b 100644
--- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/IncludeConfigurationMavenProjectStub.java
+++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/IncludeConfigurationMavenProjectStub.java
@@ -19,8 +19,8 @@
 package org.apache.maven.plugin.jxr.stubs;
 
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.InputStream;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -39,7 +39,7 @@ public class IncludeConfigurationMavenProjectStub extends JxrProjectStub {
         MavenXpp3Reader pomReader = new MavenXpp3Reader();
         Model model = null;
 
-        try (InputStream is = new FileInputStream(new File(getBasedir() + "/" + getPOM()))) {
+        try (InputStream is = Files.newInputStream(new File(getBasedir() + "/" + getPOM()).toPath())) {
             model = pomReader.read(is);
             setModel(model);
         } catch (Exception ignored) {
diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/NoJavadocDirMavenProjectStub.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/NoJavadocDirMavenProjectStub.java
index 8c75f11..9d6685c 100644
--- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/NoJavadocDirMavenProjectStub.java
+++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/NoJavadocDirMavenProjectStub.java
@@ -19,8 +19,8 @@
 package org.apache.maven.plugin.jxr.stubs;
 
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.InputStream;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -33,13 +33,13 @@ import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
  * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
  */
 public class NoJavadocDirMavenProjectStub extends JxrProjectStub {
-    private List<ReportPlugin> reportPlugins;
+    private final List<ReportPlugin> reportPlugins;
 
     public NoJavadocDirMavenProjectStub() {
         MavenXpp3Reader pomReader = new MavenXpp3Reader();
         Model model = null;
 
-        try (InputStream is = new FileInputStream(new File(getBasedir() + "/" + getPOM()))) {
+        try (InputStream is = Files.newInputStream(new File(getBasedir() + "/" + getPOM()).toPath())) {
             model = pomReader.read(is);
             setModel(model);
         } catch (Exception ignored) {
diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/NoJavadocLinkConfigurationMavenProjectStub.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/NoJavadocLinkConfigurationMavenProjectStub.java
index 8f89038..a72cb89 100644
--- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/NoJavadocLinkConfigurationMavenProjectStub.java
+++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/NoJavadocLinkConfigurationMavenProjectStub.java
@@ -19,8 +19,8 @@
 package org.apache.maven.plugin.jxr.stubs;
 
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.InputStream;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -39,7 +39,7 @@ public class NoJavadocLinkConfigurationMavenProjectStub extends JxrProjectStub {
         MavenXpp3Reader pomReader = new MavenXpp3Reader();
         Model model = null;
 
-        try (InputStream is = new FileInputStream(new File(getBasedir() + "/" + getPOM()))) {
+        try (InputStream is = Files.newInputStream(new File(getBasedir() + "/" + getPOM()).toPath())) {
             model = pomReader.read(is);
             setModel(model);
         } catch (Exception ignored) {
diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/PomMavenProjectStub.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/PomMavenProjectStub.java
index 6682ba3..e672b89 100644
--- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/PomMavenProjectStub.java
+++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/PomMavenProjectStub.java
@@ -19,8 +19,8 @@
 package org.apache.maven.plugin.jxr.stubs;
 
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.InputStream;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -38,7 +38,7 @@ public class PomMavenProjectStub extends JxrProjectStub {
         MavenXpp3Reader pomReader = new MavenXpp3Reader();
         Model model = null;
 
-        try (InputStream is = new FileInputStream(new File(getBasedir() + "/" + getPOM()))) {
+        try (InputStream is = Files.newInputStream(new File(getBasedir() + "/" + getPOM()).toPath())) {
             model = pomReader.read(is);
             setModel(model);
         } catch (Exception ignored) {
diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/TestSourceDirMavenProjectStub.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/TestSourceDirMavenProjectStub.java
index 3214caf..0517f98 100644
--- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/TestSourceDirMavenProjectStub.java
+++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/TestSourceDirMavenProjectStub.java
@@ -19,8 +19,8 @@
 package org.apache.maven.plugin.jxr.stubs;
 
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.InputStream;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -37,7 +37,7 @@ public class TestSourceDirMavenProjectStub extends JxrProjectStub {
         MavenXpp3Reader pomReader = new MavenXpp3Reader();
         Model model = null;
 
-        try (InputStream is = new FileInputStream(new File(getBasedir() + "/" + getPOM()))) {
+        try (InputStream is = Files.newInputStream(new File(getBasedir() + "/" + getPOM()).toPath())) {
             model = pomReader.read(is);
             setModel(model);
         } catch (Exception ignored) {
diff --git a/maven-jxr/pom.xml b/maven-jxr/pom.xml
index 5d12034..89d8187 100644
--- a/maven-jxr/pom.xml
+++ b/maven-jxr/pom.xml
@@ -47,8 +47,8 @@ under the License.
     </dependency>
 
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-api</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -64,7 +64,7 @@ under the License.
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-checkstyle-plugin</artifactId>
-          <!-- 
+          <!--
                The following has to be excluded from checkstyle. Otherwise
                it will fail based on the license of the file until
                a better solution exists.
diff --git a/maven-jxr/src/test/java/org/apache/maven/jxr/DirectoryIndexerTest.java b/maven-jxr/src/test/java/org/apache/maven/jxr/DirectoryIndexerTest.java
index fd6d9e6..3899a70 100644
--- a/maven-jxr/src/test/java/org/apache/maven/jxr/DirectoryIndexerTest.java
+++ b/maven-jxr/src/test/java/org/apache/maven/jxr/DirectoryIndexerTest.java
@@ -27,17 +27,17 @@ import org.apache.maven.jxr.DirectoryIndexer.PackageInfo;
 import org.apache.maven.jxr.DirectoryIndexer.ProjectInfo;
 import org.apache.maven.jxr.pacman.FileManager;
 import org.apache.maven.jxr.pacman.PackageManager;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
-public class DirectoryIndexerTest {
+class DirectoryIndexerTest {
     private DirectoryIndexer directoryIndexer;
 
-    @Before
-    public void setUp() {
+    @BeforeEach
+    void setUp() {
         FileManager fileManager = new FileManager();
         PackageManager packageManager = new PackageManager(fileManager);
         packageManager.process(Paths.get("src/test/resources/jxr68"));
@@ -50,7 +50,7 @@ public class DirectoryIndexerTest {
      * in the correct order.
      */
     @Test
-    public void testJXR_68() {
+    void jxr68() {
 
         ProjectInfo packageInfo = directoryIndexer.getProjectInfo();
         final Map<String, PackageInfo> allPackages = packageInfo.getAllPackages();
diff --git a/maven-jxr/src/test/java/org/apache/maven/jxr/IncludeExcludeTest.java b/maven-jxr/src/test/java/org/apache/maven/jxr/IncludeExcludeTest.java
index 22356ff..ddbf7f9 100644
--- a/maven-jxr/src/test/java/org/apache/maven/jxr/IncludeExcludeTest.java
+++ b/maven-jxr/src/test/java/org/apache/maven/jxr/IncludeExcludeTest.java
@@ -19,28 +19,27 @@
 package org.apache.maven.jxr;
 
 import java.nio.file.Files;
-import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.Collections;
 
 import org.apache.maven.jxr.pacman.FileManager;
 import org.apache.maven.jxr.pacman.PackageManager;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * Test include/exclude patterns.
  *
  * @author <a href="mailto:dennisl@apache.org">Dennis Lundberg</a>
  */
-public class IncludeExcludeTest {
+class IncludeExcludeTest {
     private JXR jxr;
 
-    @Before
-    public void setUp() {
+    @BeforeEach
+    void setUp() {
         FileManager fileManager = new FileManager();
         PackageManager packageManager = new PackageManager(fileManager);
         JavaCodeTransform codeTransform = new JavaCodeTransform(packageManager, fileManager);
@@ -53,17 +52,12 @@ public class IncludeExcludeTest {
     }
 
     @Test
-    public void testIncludeExclude() throws Exception {
-        String[] excludes = {"**/exclude/ExcludedClass.java"};
-        jxr.setExcludes(excludes);
-        String[] includes = {"**/exclude/*.java", "**/include/IncludedClass.java"};
-        jxr.setIncludes(includes);
+    void includeExclude() throws Exception {
+        jxr.setExcludes(new String[] {"**/exclude/ExcludedClass.java"});
+        jxr.setIncludes(new String[] {"**/exclude/*.java", "**/include/IncludedClass.java"});
         jxr.xref(Collections.singletonList("src/test/resources"), "templates/jdk4", "title", "title", "copyright");
-        Path excludedFile = Paths.get("target/exclude/ExcludedClass.html");
-        assertFalse(Files.exists(excludedFile));
-        Path includedFile = Paths.get("target/include/IncludedClass.html");
-        assertTrue(Files.exists(includedFile));
-        Path notIncludedFile = Paths.get("target/include/NotIncludedClass.html");
-        assertFalse(Files.exists(notIncludedFile));
+        assertFalse(Files.exists(Paths.get("target/exclude/ExcludedClass.html")));
+        assertTrue(Files.exists(Paths.get("target/include/IncludedClass.html")));
+        assertFalse(Files.exists(Paths.get("target/include/NotIncludedClass.html")));
     }
 }
diff --git a/maven-jxr/src/test/java/org/apache/maven/jxr/JXR141Test.java b/maven-jxr/src/test/java/org/apache/maven/jxr/JXR141Test.java
index 2b1a6f0..2f5e040 100644
--- a/maven-jxr/src/test/java/org/apache/maven/jxr/JXR141Test.java
+++ b/maven-jxr/src/test/java/org/apache/maven/jxr/JXR141Test.java
@@ -26,21 +26,21 @@ import java.util.List;
 
 import org.apache.maven.jxr.pacman.FileManager;
 import org.apache.maven.jxr.pacman.PackageManager;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 
 /**
  * Simple unit-testtest that illustrates a line with more
  * than one "token" to replace
  */
-public class JXR141Test {
+class JXR141Test {
     private JXR jxr;
 
-    @Before
-    public void setUp() {
+    @BeforeEach
+    void setUp() {
         FileManager fileManager = new FileManager();
         PackageManager packageManager = new PackageManager(fileManager);
         JavaCodeTransform codeTransform = new JavaCodeTransform(packageManager, fileManager);
@@ -49,7 +49,7 @@ public class JXR141Test {
     }
 
     @Test
-    public void testProcessPath() throws Exception {
+    void processPath() throws Exception {
         jxr.setDest(Paths.get("target/jxr-141"));
         jxr.setOutputEncoding("UTF-8");
         jxr.xref(
@@ -70,7 +70,7 @@ public class JXR141Test {
             }
         }
 
-        assertNotNull("Line #27 not found - has source of Test141.java changed?", line27);
+        assertNotNull(line27, "Line #27 not found - has source of Test141.java changed?");
         assertEquals(
                 "<a class=\"jxr_linenumber\" name=\"L27\" href=\"#L27\">27</a>      "
                         + "<strong class=\"jxr_keyword\">public</strong> <strong class=\"jxr_keyword\">static</strong> "
diff --git a/maven-jxr/src/test/java/org/apache/maven/jxr/JavaCodeTransformTest.java b/maven-jxr/src/test/java/org/apache/maven/jxr/JavaCodeTransformTest.java
index 84e4658..0a282e2 100644
--- a/maven-jxr/src/test/java/org/apache/maven/jxr/JavaCodeTransformTest.java
+++ b/maven-jxr/src/test/java/org/apache/maven/jxr/JavaCodeTransformTest.java
@@ -26,20 +26,20 @@ import java.util.Locale;
 
 import org.apache.maven.jxr.pacman.FileManager;
 import org.apache.maven.jxr.pacman.PackageManager;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * JUnit test for {@link JavaCodeTransform}.
  */
-public class JavaCodeTransformTest {
+class JavaCodeTransformTest {
     /** JavaCodeTransform object under test */
     private JavaCodeTransform codeTransform;
 
-    @Before
-    public void setUp() {
+    @BeforeEach
+    void setUp() {
         FileManager fileManager = new FileManager();
         codeTransform = new JavaCodeTransform(new PackageManager(fileManager), fileManager);
     }
@@ -48,7 +48,7 @@ public class JavaCodeTransformTest {
      * Test basic transformation of a java source file.
      */
     @Test
-    public void testTransform()
+    void transform()
             // test transforms its own sourcefile, so add some comments
             throws Exception // single line despite /*
             {
@@ -60,8 +60,7 @@ public class JavaCodeTransformTest {
         */
         codeTransform.transform(
                 sourceFile,
-                Paths.get("target/JavaCodeTransformTest.html") // additional comment
-                ,
+                Paths.get("target/JavaCodeTransformTest.html"),
                 Locale.ENGLISH,
                 "ISO-8859-1",
                 "ISO-8859-1",
@@ -81,7 +80,7 @@ public class JavaCodeTransformTest {
      * Test what happens with an empty sourcefile.
      */
     @Test
-    public void testTransformWithEmptyClassFile() throws Exception {
+    void transformWithEmptyClassFile() throws Exception {
         Path sourceFile = Paths.get("src/test/resources/EmptyClass.java");
         assertTrue(Files.exists(sourceFile));
 
@@ -106,7 +105,7 @@ public class JavaCodeTransformTest {
      * Test proper handling of link
      */
     @Test
-    public void testLinkHandling() throws Exception {
+    void linkHandling() throws Exception {
         Path sourceFile = Paths.get("src/test/resources/ClassWithLink.java");
         assertTrue(Files.exists(sourceFile));
 
@@ -135,7 +134,7 @@ public class JavaCodeTransformTest {
      * Test what happens with unknown java type.
      */
     @Test
-    public void testTransformWithUnknownJavaType() throws Exception {
+    void transformWithUnknownJavaType() throws Exception {
         Path sourceFile = Paths.get("src/test/resources/UnknownType.java");
         assertTrue(Files.exists(sourceFile));
 
diff --git a/maven-jxr/src/test/java/org/apache/maven/jxr/JxrBeanTest.java b/maven-jxr/src/test/java/org/apache/maven/jxr/JxrBeanTest.java
index 3e688c8..a9b1b0f 100644
--- a/maven-jxr/src/test/java/org/apache/maven/jxr/JxrBeanTest.java
+++ b/maven-jxr/src/test/java/org/apache/maven/jxr/JxrBeanTest.java
@@ -23,14 +23,14 @@ import java.util.Collections;
 
 import org.apache.maven.jxr.pacman.FileManager;
 import org.apache.maven.jxr.pacman.PackageManager;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-public class JxrBeanTest {
+class JxrBeanTest {
     private JXR jxrBean;
 
-    @Before
-    public void setUp() {
+    @BeforeEach
+    void setUp() {
         FileManager fileManager = new FileManager();
         PackageManager packageManager = new PackageManager(fileManager);
         JavaCodeTransform codeTransform = new JavaCodeTransform(packageManager, fileManager);
@@ -42,7 +42,7 @@ public class JxrBeanTest {
     }
 
     @Test
-    public void testXref() throws Exception {
+    void xref() throws Exception {
         jxrBean.xref(Collections.singletonList("src/test/java"), "templates/jdk4", "title", "title", "copyright");
     }
 }
diff --git a/maven-jxr/src/test/java/org/apache/maven/jxr/pacman/JavaFileImplTest.java b/maven-jxr/src/test/java/org/apache/maven/jxr/pacman/JavaFileImplTest.java
index e3032a7..8445a39 100644
--- a/maven-jxr/src/test/java/org/apache/maven/jxr/pacman/JavaFileImplTest.java
+++ b/maven-jxr/src/test/java/org/apache/maven/jxr/pacman/JavaFileImplTest.java
@@ -22,13 +22,13 @@ import java.io.IOException;
 import java.nio.file.Paths;
 import java.util.Iterator;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
-public class JavaFileImplTest {
+class JavaFileImplTest {
     @Test
-    public void testJXR_135_lotsOfNested() throws IOException {
+    void jxr_135LotsOfNested() throws IOException {
         JavaFileImpl javaFile = new JavaFileImpl(
                 Paths.get("src/test/resources/jxr135/org/apache/maven/jxr/pacman/ClassWithNested.java"), "UTF-8");
         final Iterator<ClassType> classTypes = javaFile.getClassTypes().iterator();
@@ -52,7 +52,7 @@ public class JavaFileImplTest {
     }
 
     @Test
-    public void testJXR_170_multiLineString() throws IOException {
+    void jxr_170MultiLineString() throws IOException {
         JavaFileImpl javaFile = new JavaFileImpl(
                 Paths.get("src/test/resources/jxr170/org/apache/maven/jxr/pacman/ClassWithMultiLineString.java"),
                 "UTF-8");
@@ -62,7 +62,7 @@ public class JavaFileImplTest {
     }
 
     @Test
-    public void testJXR_175_java14Record() throws IOException {
+    void jxr_175Java14Record() throws IOException {
         JavaFileImpl javaFile = new JavaFileImpl(
                 Paths.get("src/test/resources/jxr175/org/apache/maven/jxr/pacman/Java14Record.java"), "UTF-8");
         assertEquals(1, javaFile.getClassTypes().size());
diff --git a/maven-jxr/src/test/java/org/apache/maven/jxr/util/SimpleWordTokenizerTest.java b/maven-jxr/src/test/java/org/apache/maven/jxr/util/SimpleWordTokenizerTest.java
index 6f2d7c2..083545e 100644
--- a/maven-jxr/src/test/java/org/apache/maven/jxr/util/SimpleWordTokenizerTest.java
+++ b/maven-jxr/src/test/java/org/apache/maven/jxr/util/SimpleWordTokenizerTest.java
@@ -20,13 +20,13 @@ package org.apache.maven.jxr.util;
 
 import java.util.List;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
-public class SimpleWordTokenizerTest {
+class SimpleWordTokenizerTest {
     @Test
-    public void testCompact() {
+    void compact() {
         List<StringEntry> entries = SimpleWordTokenizer.tokenize("public void withApp1(App app)");
         assertEquals(5, entries.size());
 
@@ -47,7 +47,7 @@ public class SimpleWordTokenizerTest {
     }
 
     @Test
-    public void testSpacesAroundParenOpen() {
+    void spacesAroundParenOpen() {
         List<StringEntry> entries = SimpleWordTokenizer.tokenize("public void withApp2 ( App app)");
         assertEquals(5, entries.size());
 
@@ -68,7 +68,7 @@ public class SimpleWordTokenizerTest {
     }
 
     @Test
-    public void testSpaceBeforeParenOpen() {
+    void spaceBeforeParenOpen() {
         List<StringEntry> entries = SimpleWordTokenizer.tokenize("public void withApp3 (App app)");
         assertEquals(5, entries.size());
 
@@ -89,7 +89,7 @@ public class SimpleWordTokenizerTest {
     }
 
     @Test
-    public void testSpaceAfterParenOpen() {
+    void spaceAfterParenOpen() {
         List<StringEntry> entries = SimpleWordTokenizer.tokenize("public void withApp4( App app)");
         assertEquals(5, entries.size());
 
@@ -110,7 +110,7 @@ public class SimpleWordTokenizerTest {
     }
 
     @Test
-    public void testWithIndent() {
+    void withIndent() {
         List<StringEntry> entries = SimpleWordTokenizer.tokenize("    public void withApp3 (App app)", "App");
         assertEquals(1, entries.size());
 
diff --git a/pom.xml b/pom.xml
index 7e1c202..bda8241 100644
--- a/pom.xml
+++ b/pom.xml
@@ -106,11 +106,6 @@ under the License.
         <artifactId>slf4j-simple</artifactId>
         <version>${slf4jVersion}</version>
       </dependency>
-      <dependency>
-        <groupId>junit</groupId>
-        <artifactId>junit</artifactId>
-        <version>4.13.2</version>
-      </dependency>
     </dependencies>
   </dependencyManagement>