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

sjaranowski pushed a commit to branch junit5
in repository https://gitbox.apache.org/repos/asf/maven-dependency-analyzer.git

commit 07c61a167031321d28919fd1f677938c861498b4
Author: Slawomir Jaranowski <s.jaranow...@gmail.com>
AuthorDate: Fri Mar 31 23:43:32 2023 +0200

    [MSHARED-1249] Switch to JUnit 5
---
 pom.xml                                            |   6 +-
 .../analyzer/ClassFileVisitorUtilsTest.java        |  64 ++++----
 .../analyzer/CollectorClassFileVisitorTest.java    |  12 +-
 .../analyzer/DefaultClassAnalyzerTest.java         |  29 ++--
 .../analyzer/ProjectDependencyAnalysisTest.java    |   8 +-
 .../ProjectDependencyAnalyzerExceptionTest.java    |   8 +-
 .../analyzer/asm/ASMDependencyAnalyzerTest.java    |   6 +-
 .../analyzer/asm/DependencyVisitorTest.java        | 168 +++++++++++----------
 .../analyzer/asm/ResultCollectorTest.java          |  12 +-
 9 files changed, 154 insertions(+), 159 deletions(-)

diff --git a/pom.xml b/pom.xml
index 723d952..a2c30ab 100644
--- a/pom.xml
+++ b/pom.xml
@@ -104,9 +104,9 @@
 
     <!-- testing support -->
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.13.2</version>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-api</artifactId>
+      <version>5.9.3</version>
       <scope>test</scope>
     </dependency>
     <dependency>
diff --git 
a/src/test/java/org/apache/maven/shared/dependency/analyzer/ClassFileVisitorUtilsTest.java
 
b/src/test/java/org/apache/maven/shared/dependency/analyzer/ClassFileVisitorUtilsTest.java
index 1502c8b..fb644e8 100644
--- 
a/src/test/java/org/apache/maven/shared/dependency/analyzer/ClassFileVisitorUtilsTest.java
+++ 
b/src/test/java/org/apache/maven/shared/dependency/analyzer/ClassFileVisitorUtilsTest.java
@@ -18,10 +18,10 @@
  */
 package org.apache.maven.shared.dependency.analyzer;
 
-import java.io.File;
-import java.io.FileOutputStream;
+import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.net.URL;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
@@ -31,9 +31,8 @@ import java.util.List;
 import java.util.jar.JarOutputStream;
 import java.util.zip.ZipEntry;
 
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.fail;
@@ -44,36 +43,36 @@ import static org.assertj.core.api.Assertions.fail;
  * @author <a href="mailto:markhob...@gmail.com";>Mark Hobson</a>
  * @see ClassFileVisitorUtils
  */
-public class ClassFileVisitorUtilsTest {
+class ClassFileVisitorUtilsTest {
+
+    @TempDir
+    private Path tempDir;
+
     private TestVisitor visitor = new TestVisitor();
 
     private static class TestVisitor implements ClassFileVisitor {
         final List<String> classNames = new ArrayList<>();
+
         final List<String> data = new ArrayList<>();
 
         @Override
         public void visitClass(String className, InputStream in) {
             classNames.add(className);
-            try {
-                List<String> lines = IOUtils.readLines(in, 
StandardCharsets.UTF_8);
-                data.addAll(lines);
-            } catch (IOException ex) {
-                throw new RuntimeException(ex);
-            }
+            BufferedReader reader = new BufferedReader(new 
InputStreamReader(in, StandardCharsets.UTF_8));
+            reader.lines().forEach(data::add);
         }
     }
 
     @Test
-    public void testAcceptJar() throws IOException {
-        File file = File.createTempFile("test", ".jar");
-        file.deleteOnExit();
+    void testAcceptJar() throws IOException {
+        Path path = Files.createTempFile(tempDir, "test", ".jar");
 
-        try (JarOutputStream out = new JarOutputStream(new 
FileOutputStream(file))) {
+        try (JarOutputStream out = new 
JarOutputStream(Files.newOutputStream(path))) {
             addZipEntry(out, "a/b/c.class", "class a.b.c");
             addZipEntry(out, "x/y/z.class", "class x.y.z");
         }
 
-        ClassFileVisitorUtils.accept(file.toURI().toURL(), visitor);
+        ClassFileVisitorUtils.accept(path.toUri().toURL(), visitor);
 
         assertThat(visitor.classNames).contains("a.b.c");
         assertThat(visitor.classNames).contains("x.y.z");
@@ -82,22 +81,21 @@ public class ClassFileVisitorUtilsTest {
     }
 
     @Test
-    public void testAcceptJarWithNonClassEntry() throws IOException {
-        File file = File.createTempFile("test", ".jar");
-        file.deleteOnExit();
+    void testAcceptJarWithNonClassEntry() throws IOException {
+        Path path = Files.createTempFile(tempDir, "test", ".jar");
 
-        try (JarOutputStream out = new JarOutputStream(new 
FileOutputStream(file))) {
+        try (JarOutputStream out = new 
JarOutputStream(Files.newOutputStream(path))) {
             addZipEntry(out, "a/b/c.jpg", "jpeg a.b.c");
         }
 
-        ClassFileVisitorUtils.accept(file.toURI().toURL(), visitor);
+        ClassFileVisitorUtils.accept(path.toUri().toURL(), visitor);
 
         assertThat(visitor.classNames).isEmpty();
     }
 
     @Test
-    public void testAcceptDir() throws IOException {
-        Path dir = Files.createTempDirectory("d-a-test");
+    void testAcceptDir() throws IOException {
+        Path dir = Files.createTempDirectory(tempDir, "d-a-test");
 
         Path abDir = Files.createDirectories(dir.resolve("a/b"));
         writeToFile(abDir, "c.class", "class a.b.c");
@@ -107,8 +105,6 @@ public class ClassFileVisitorUtilsTest {
 
         ClassFileVisitorUtils.accept(dir.toUri().toURL(), visitor);
 
-        FileUtils.deleteDirectory(dir.toFile());
-
         assertThat(visitor.classNames).contains("a.b.c");
         assertThat(visitor.classNames).contains("x.y.z");
         assertThat(visitor.data).contains("class a.b.c");
@@ -116,25 +112,21 @@ public class ClassFileVisitorUtilsTest {
     }
 
     @Test
-    public void testAcceptDirWithNonClassFile() throws IOException {
-        Path dir = Files.createTempDirectory("d-a-test");
+    void testAcceptDirWithNonClassFile() throws IOException {
+        Path dir = Files.createTempDirectory(tempDir, "d-a-test");
 
         Path abDir = Files.createDirectories(dir.resolve("a/b"));
         writeToFile(abDir, "c.jpg", "jpeg a.b.c");
 
         ClassFileVisitorUtils.accept(dir.toUri().toURL(), visitor);
 
-        FileUtils.deleteDirectory(dir.toFile());
-
         assertThat(visitor.classNames).isEmpty();
     }
 
     @Test
-    public void testAcceptWithFile() throws IOException {
-        File file = File.createTempFile("test", ".class");
-        file.deleteOnExit();
-
-        URL url = file.toURI().toURL();
+    void testAcceptWithFile() throws IOException {
+        Path path = Files.createTempFile(tempDir, "test", ".class");
+        URL url = path.toUri().toURL();
 
         try {
             ClassFileVisitorUtils.accept(url, visitor);
@@ -145,7 +137,7 @@ public class ClassFileVisitorUtilsTest {
     }
 
     @Test
-    public void testAcceptWithUnsupportedScheme() throws IOException {
+    void testAcceptWithUnsupportedScheme() throws IOException {
         URL url = new URL("http://localhost/";);
 
         try {
diff --git 
a/src/test/java/org/apache/maven/shared/dependency/analyzer/CollectorClassFileVisitorTest.java
 
b/src/test/java/org/apache/maven/shared/dependency/analyzer/CollectorClassFileVisitorTest.java
index cb44245..9ae1faf 100644
--- 
a/src/test/java/org/apache/maven/shared/dependency/analyzer/CollectorClassFileVisitorTest.java
+++ 
b/src/test/java/org/apache/maven/shared/dependency/analyzer/CollectorClassFileVisitorTest.java
@@ -21,8 +21,8 @@ package org.apache.maven.shared.dependency.analyzer;
 import java.util.HashSet;
 import java.util.Set;
 
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
@@ -32,16 +32,16 @@ import static org.assertj.core.api.Assertions.assertThat;
  * @author <a href="mailto:markhob...@gmail.com";>Mark Hobson</a>
  * @see CollectorClassFileVisitor
  */
-public class CollectorClassFileVisitorTest {
+class CollectorClassFileVisitorTest {
     private CollectorClassFileVisitor visitor;
 
-    @Before
-    public void setUp() {
+    @BeforeEach
+    void setUp() {
         visitor = new CollectorClassFileVisitor();
     }
 
     @Test
-    public void testVisitClass() {
+    void testVisitClass() {
         visitor.visitClass("a.b.c", null);
         visitor.visitClass("x.y.z", null);
 
diff --git 
a/src/test/java/org/apache/maven/shared/dependency/analyzer/DefaultClassAnalyzerTest.java
 
b/src/test/java/org/apache/maven/shared/dependency/analyzer/DefaultClassAnalyzerTest.java
index 45c04bb..5edb864 100644
--- 
a/src/test/java/org/apache/maven/shared/dependency/analyzer/DefaultClassAnalyzerTest.java
+++ 
b/src/test/java/org/apache/maven/shared/dependency/analyzer/DefaultClassAnalyzerTest.java
@@ -30,9 +30,9 @@ import java.util.jar.JarOutputStream;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipException;
 
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.fail;
@@ -43,27 +43,24 @@ import static org.assertj.core.api.Assertions.fail;
  * @author <a href="mailto:markhob...@gmail.com";>Mark Hobson</a>
  * @see DefaultClassAnalyzer
  */
-public class DefaultClassAnalyzerTest {
+class DefaultClassAnalyzerTest {
+
+    @TempDir
+    private Path tempDir;
+
     private Path file;
 
-    @Before
-    public void setUp() throws IOException {
-        file = Files.createTempFile("test", ".jar");
+    @BeforeEach
+    void setUp() throws IOException {
+        file = Files.createTempFile(tempDir, "test", ".jar");
         try (JarOutputStream out = new JarOutputStream(new 
FileOutputStream(file.toFile()))) {
             addZipEntry(out, "a/b/c.class", "class a.b.c");
             addZipEntry(out, "x/y/z.class", "class x.y.z");
         }
     }
 
-    @After
-    public void cleanup() throws IOException {
-        if (file != null) {
-            Files.deleteIfExists(file);
-        }
-    }
-
     @Test
-    public void testAnalyzeWithJar() throws IOException {
+    void testAnalyzeWithJar() throws IOException {
         Set<String> expectedClasses = new HashSet<>();
         expectedClasses.add("a.b.c");
         expectedClasses.add("x.y.z");
@@ -75,7 +72,7 @@ public class DefaultClassAnalyzerTest {
     }
 
     @Test
-    public void testAnalyzeBadJar() throws IOException {
+    void testAnalyzeBadJar() throws IOException {
         // to reproduce MDEP-143
         // corrupt the jar file by altering its contents
         ByteArrayOutputStream baos = new ByteArrayOutputStream(100);
diff --git 
a/src/test/java/org/apache/maven/shared/dependency/analyzer/ProjectDependencyAnalysisTest.java
 
b/src/test/java/org/apache/maven/shared/dependency/analyzer/ProjectDependencyAnalysisTest.java
index 4eff14e..f7389e9 100644
--- 
a/src/test/java/org/apache/maven/shared/dependency/analyzer/ProjectDependencyAnalysisTest.java
+++ 
b/src/test/java/org/apache/maven/shared/dependency/analyzer/ProjectDependencyAnalysisTest.java
@@ -25,7 +25,7 @@ import java.util.Set;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.DefaultArtifact;
 import org.apache.maven.artifact.versioning.VersionRange;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
@@ -35,9 +35,9 @@ import static org.assertj.core.api.Assertions.assertThat;
  * @author <a href="mailto:markhob...@gmail.com";>Mark Hobson</a>
  * @see ProjectDependencyAnalysis
  */
-public class ProjectDependencyAnalysisTest {
+class ProjectDependencyAnalysisTest {
     @Test
-    public void testConstructor() {
+    void testConstructor() {
         Set<Artifact> usedDeclaredArtifacts = new HashSet<>();
         Set<Artifact> usedUndeclaredArtifacts = new HashSet<>();
         Set<Artifact> unusedDeclaredArtifacts = new HashSet<>();
@@ -52,7 +52,7 @@ public class ProjectDependencyAnalysisTest {
     }
 
     @Test
-    public void ignoreNonCompileShouldFilterOnlyUnusedDeclare() {
+    void ignoreNonCompileShouldFilterOnlyUnusedDeclare() {
         Artifact artifactCompile = aTestArtifact("test1", 
Artifact.SCOPE_COMPILE);
         Artifact artifactProvided = aTestArtifact("test2", 
Artifact.SCOPE_PROVIDED);
         Artifact artifactTest = aTestArtifact("test3", Artifact.SCOPE_TEST);
diff --git 
a/src/test/java/org/apache/maven/shared/dependency/analyzer/ProjectDependencyAnalyzerExceptionTest.java
 
b/src/test/java/org/apache/maven/shared/dependency/analyzer/ProjectDependencyAnalyzerExceptionTest.java
index e16a6cd..1d2f72c 100644
--- 
a/src/test/java/org/apache/maven/shared/dependency/analyzer/ProjectDependencyAnalyzerExceptionTest.java
+++ 
b/src/test/java/org/apache/maven/shared/dependency/analyzer/ProjectDependencyAnalyzerExceptionTest.java
@@ -18,7 +18,7 @@
  */
 package org.apache.maven.shared.dependency.analyzer;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
@@ -28,14 +28,14 @@ import static org.assertj.core.api.Assertions.assertThat;
  * @author <a href="mailto:markhob...@gmail.com";>Mark Hobson</a>
  * @see ProjectDependencyAnalyzerException
  */
-public class ProjectDependencyAnalyzerExceptionTest {
+class ProjectDependencyAnalyzerExceptionTest {
     @Test
-    public void testConstructor() {
+    void testConstructor() {
         assertThat(new 
ProjectDependencyAnalyzerException("a")).hasMessage("a");
     }
 
     @Test
-    public void testConstructorWithThrowable() {
+    void testConstructorWithThrowable() {
         Throwable throwable = new Exception();
         ProjectDependencyAnalyzerException exception = new 
ProjectDependencyAnalyzerException("a", throwable);
 
diff --git 
a/src/test/java/org/apache/maven/shared/dependency/analyzer/asm/ASMDependencyAnalyzerTest.java
 
b/src/test/java/org/apache/maven/shared/dependency/analyzer/asm/ASMDependencyAnalyzerTest.java
index ee54a97..cecf685 100644
--- 
a/src/test/java/org/apache/maven/shared/dependency/analyzer/asm/ASMDependencyAnalyzerTest.java
+++ 
b/src/test/java/org/apache/maven/shared/dependency/analyzer/asm/ASMDependencyAnalyzerTest.java
@@ -22,15 +22,15 @@ import java.net.URL;
 import java.util.Set;
 
 import org.apache.maven.shared.dependency.analyzer.DependencyAnalyzer;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-public class ASMDependencyAnalyzerTest {
+class ASMDependencyAnalyzerTest {
     private final DependencyAnalyzer analyzer = new ASMDependencyAnalyzer();
 
     @Test
-    public void test() throws Exception {
+    void test() throws Exception {
         URL jarUrl = 
this.getClass().getResource("/org/objectweb/asm/ClassReader.class");
         assertThat(jarUrl).isNotNull();
         String fileUrl =
diff --git 
a/src/test/java/org/apache/maven/shared/dependency/analyzer/asm/DependencyVisitorTest.java
 
b/src/test/java/org/apache/maven/shared/dependency/analyzer/asm/DependencyVisitorTest.java
index b02abcf..8ee3c44 100644
--- 
a/src/test/java/org/apache/maven/shared/dependency/analyzer/asm/DependencyVisitorTest.java
+++ 
b/src/test/java/org/apache/maven/shared/dependency/analyzer/asm/DependencyVisitorTest.java
@@ -18,9 +18,15 @@
  */
 package org.apache.maven.shared.dependency.analyzer.asm;
 
-import org.junit.Before;
-import org.junit.Test;
-import org.objectweb.asm.*;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.Attribute;
+import org.objectweb.asm.FieldVisitor;
+import org.objectweb.asm.Label;
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.Type;
 import org.objectweb.asm.signature.SignatureVisitor;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -30,13 +36,13 @@ import static org.assertj.core.api.Assertions.assertThat;
  *
  * @author <a href="mailto:markhob...@gmail.com";>Mark Hobson</a>
  */
-public class DependencyVisitorTest {
+class DependencyVisitorTest {
     private final ResultCollector resultCollector = new ResultCollector();
     private DefaultClassVisitor visitor;
     private MethodVisitor mv;
 
-    @Before
-    public void setUp() {
+    @BeforeEach
+    void setUp() {
         AnnotationVisitor annotationVisitor = new 
DefaultAnnotationVisitor(resultCollector);
         SignatureVisitor signatureVisitor = new 
DefaultSignatureVisitor(resultCollector);
         FieldVisitor fieldVisitor = new DefaultFieldVisitor(annotationVisitor, 
resultCollector);
@@ -45,7 +51,7 @@ public class DependencyVisitorTest {
     }
 
     @Test
-    public void testVisitWithDefaultSuperclass() {
+    void testVisitWithDefaultSuperclass() {
         // class a.b.c
         visitor.visit(50, 0, "a/b/c", null, "java/lang/Object", null);
 
@@ -53,7 +59,7 @@ public class DependencyVisitorTest {
     }
 
     @Test
-    public void testVisitWithSuperclass() {
+    void testVisitWithSuperclass() {
         // class a.b.c
         visitor.visit(50, 0, "a/b/c", null, "x/y/z", null);
 
@@ -61,7 +67,7 @@ public class DependencyVisitorTest {
     }
 
     @Test
-    public void testVisitWithInterface() {
+    void testVisitWithInterface() {
         // class a.b.c implements x.y.z
         visitor.visit(50, 0, "a/b/c", null, "java/lang/Object", new String[] 
{"x/y/z"});
 
@@ -69,7 +75,7 @@ public class DependencyVisitorTest {
     }
 
     @Test
-    public void testVisitWithInterfaces() {
+    void testVisitWithInterfaces() {
         // class a.b.c implements p.q.r, x.y.z
         visitor.visit(50, 0, "a/b/c", null, "java/lang/Object", new String[] 
{"p/q/r", "x/y/z"});
 
@@ -77,7 +83,7 @@ public class DependencyVisitorTest {
     }
 
     @Test
-    public void testVisitWithUnboundedClassTypeParameter() {
+    void testVisitWithUnboundedClassTypeParameter() {
         // class a.b.c<T>
         String signature = "<T:Ljava/lang/Object;>Ljava/lang/Object;";
 
@@ -87,7 +93,7 @@ public class DependencyVisitorTest {
     }
 
     @Test
-    public void testVisitWithBoundedClassTypeParameter() {
+    void testVisitWithBoundedClassTypeParameter() {
         // class a.b.c<T extends x.y.z>
         String signature = "<T:Lx/y/z;>Ljava/lang/Object;";
 
@@ -97,7 +103,7 @@ public class DependencyVisitorTest {
     }
 
     @Test
-    public void testVisitWithBoundedClassTypeParameters() {
+    void testVisitWithBoundedClassTypeParameters() {
         // class a.b.c<K extends p.q.r, V extends x.y.z>
         String signature = "<K:Lp/q/r;V:Lx/y/z;>Ljava/lang/Object;";
 
@@ -107,7 +113,7 @@ public class DependencyVisitorTest {
     }
 
     @Test
-    public void testVisitWithGenericInterface() {
+    void testVisitWithGenericInterface() {
         // class a.b.c implements p.q.r<x.y.z>
         String signature = "Ljava/lang/Object;Lp/q/r<Lx/y/z;>;";
 
@@ -117,7 +123,7 @@ public class DependencyVisitorTest {
     }
 
     @Test
-    public void testVisitWithInterfaceBound() {
+    void testVisitWithInterfaceBound() {
         // class a.b.c<T> implements x.y.z<T>
         String signature = 
"<T:Ljava/lang/Object;>Ljava/lang/Object;Lx/y/z<TT;>;";
 
@@ -129,7 +135,7 @@ public class DependencyVisitorTest {
     // visitSource tests ------------------------------------------------------
 
     @Test
-    public void testVisitSource() {
+    void testVisitSource() {
         visitor.visitSource(null, null);
 
         assertThat(resultCollector.getDependencies()).isEmpty();
@@ -138,7 +144,7 @@ public class DependencyVisitorTest {
     // visitOuterClass tests --------------------------------------------------
 
     @Test
-    public void testVisitOuterClass() {
+    void testVisitOuterClass() {
         // class a.b.c
         // {
         //     class ...
@@ -151,7 +157,7 @@ public class DependencyVisitorTest {
     }
 
     @Test
-    public void testVisitOuterClassInMethod() {
+    void testVisitOuterClassInMethod() {
         // class a.b.c
         // {
         //     x.y.z x(p.q.r p)
@@ -169,14 +175,14 @@ public class DependencyVisitorTest {
     // visitAnnotation tests --------------------------------------------------
 
     @Test
-    public void testVisitAnnotation() {
+    void testVisitAnnotation() {
         assertVisitor(visitor.visitAnnotation("La/b/c;", false));
 
         assertThat(resultCollector.getDependencies()).containsOnly("a.b.c");
     }
 
     @Test
-    public void testVisitAnnotationWithRuntimeVisibility() {
+    void testVisitAnnotationWithRuntimeVisibility() {
         assertVisitor(visitor.visitAnnotation("La/b/c;", true));
 
         assertThat(resultCollector.getDependencies()).containsOnly("a.b.c");
@@ -185,7 +191,7 @@ public class DependencyVisitorTest {
     // visitAttribute tests ---------------------------------------------------
 
     @Test
-    public void testVisitAttribute() {
+    void testVisitAttribute() {
         visitor.visitAttribute(new MockAttribute("a"));
 
         assertThat(resultCollector.getDependencies()).isEmpty();
@@ -194,7 +200,7 @@ public class DependencyVisitorTest {
     // visitInnerClass tests --------------------------------------------------
 
     @Test
-    public void testVisitInnerClass() {
+    void testVisitInnerClass() {
         // TODO: ensure innerName is correct
 
         // class a.b.c { class x.y.z { } }
@@ -204,7 +210,7 @@ public class DependencyVisitorTest {
     }
 
     @Test
-    public void testVisitInnerClassAnonymous() {
+    void testVisitInnerClassAnonymous() {
         // class a.b.c { new class x.y.z { } }
         visitor.visitInnerClass("x/y/z$1", "a/b/c", null, 0);
 
@@ -214,7 +220,7 @@ public class DependencyVisitorTest {
     // visitField tests -------------------------------------------------------
 
     @Test
-    public void testVisitField() {
+    void testVisitField() {
         // a.b.c a
         assertVisitor(visitor.visitField(0, "a", "La/b/c;", null, null));
 
@@ -222,12 +228,12 @@ public class DependencyVisitorTest {
     }
 
     // TODO: determine actual use of default values
-    // public void testVisitFieldWithValue()
+    // void testVisitFieldWithValue()
     // {
     // }
 
     @Test
-    public void testVisitFieldArray() {
+    void testVisitFieldArray() {
         // a.b.c[] a
         assertVisitor(visitor.visitField(0, "a", "[La/b/c;", null, null));
 
@@ -235,7 +241,7 @@ public class DependencyVisitorTest {
     }
 
     @Test
-    public void testVisitFieldGeneric() {
+    void testVisitFieldGeneric() {
         // a.b.c<x.y.z> a
         assertVisitor(visitor.visitField(0, "a", "La/b/c;", 
"La/b/c<Lx/y/z;>;", null));
 
@@ -245,7 +251,7 @@ public class DependencyVisitorTest {
     // visitMethod tests ------------------------------------------------------
 
     @Test
-    public void testVisitMethod() {
+    void testVisitMethod() {
         // void a()
         assertVisitor(visitor.visitMethod(0, "a", "()V", null, null));
 
@@ -253,7 +259,7 @@ public class DependencyVisitorTest {
     }
 
     @Test
-    public void testVisitMethodWithPrimitiveArgument() {
+    void testVisitMethodWithPrimitiveArgument() {
         // void a(int)
         assertVisitor(visitor.visitMethod(0, "a", "(I)V", null, null));
 
@@ -261,7 +267,7 @@ public class DependencyVisitorTest {
     }
 
     @Test
-    public void testVisitMethodWithPrimitiveArrayArgument() {
+    void testVisitMethodWithPrimitiveArrayArgument() {
         // void a(int[])
         assertVisitor(visitor.visitMethod(0, "a", "([I)V", null, null));
 
@@ -269,7 +275,7 @@ public class DependencyVisitorTest {
     }
 
     @Test
-    public void testVisitMethodWithObjectArgument() {
+    void testVisitMethodWithObjectArgument() {
         // void a(a.b.c)
         assertVisitor(visitor.visitMethod(0, "a", "(La/b/c;)V", null, null));
 
@@ -277,7 +283,7 @@ public class DependencyVisitorTest {
     }
 
     @Test
-    public void testVisitMethodWithObjectArguments() {
+    void testVisitMethodWithObjectArguments() {
         // void a(a.b.c, x.y.z)
         assertVisitor(visitor.visitMethod(0, "a", "(La/b/c;Lx/y/z;)V", null, 
null));
 
@@ -285,7 +291,7 @@ public class DependencyVisitorTest {
     }
 
     @Test
-    public void testVisitMethodWithObjectArrayArgument() {
+    void testVisitMethodWithObjectArrayArgument() {
         // void a(a.b.c[])
         assertVisitor(visitor.visitMethod(0, "a", "([La/b/c;)V", null, null));
 
@@ -293,7 +299,7 @@ public class DependencyVisitorTest {
     }
 
     @Test
-    public void testVisitMethodWithGenericArgument() {
+    void testVisitMethodWithGenericArgument() {
         // void a(a.b.c<x.y.z>)
         assertVisitor(visitor.visitMethod(0, "a", "(La/b/c;)V", 
"(La/b/c<Lx/y/z;>;)V", null));
 
@@ -301,7 +307,7 @@ public class DependencyVisitorTest {
     }
 
     @Test
-    public void testVisitMethodWithPrimitiveReturnType() {
+    void testVisitMethodWithPrimitiveReturnType() {
         // int a()
         assertVisitor(visitor.visitMethod(0, "a", "()I", null, null));
 
@@ -309,7 +315,7 @@ public class DependencyVisitorTest {
     }
 
     @Test
-    public void testVisitMethodWithPrimitiveArrayReturnType() {
+    void testVisitMethodWithPrimitiveArrayReturnType() {
         // int[] a()
         assertVisitor(visitor.visitMethod(0, "a", "()[I", null, null));
 
@@ -317,7 +323,7 @@ public class DependencyVisitorTest {
     }
 
     @Test
-    public void testVisitMethodWithObjectReturnType() {
+    void testVisitMethodWithObjectReturnType() {
         // a.b.c a()
         assertVisitor(visitor.visitMethod(0, "a", "()La/b/c;", null, null));
 
@@ -325,7 +331,7 @@ public class DependencyVisitorTest {
     }
 
     @Test
-    public void testVisitMethodWithObjectArrayReturnType() {
+    void testVisitMethodWithObjectArrayReturnType() {
         // a.b.c[] a()
         assertVisitor(visitor.visitMethod(0, "a", "()[La/b/c;", null, null));
 
@@ -333,7 +339,7 @@ public class DependencyVisitorTest {
     }
 
     @Test
-    public void testVisitMethodWithException() {
+    void testVisitMethodWithException() {
         // void a() throws a.b.c
         assertVisitor(visitor.visitMethod(0, "a", "()V", null, new String[] 
{"a/b/c"}));
 
@@ -341,7 +347,7 @@ public class DependencyVisitorTest {
     }
 
     @Test
-    public void testVisitMethodWithExceptions() {
+    void testVisitMethodWithExceptions() {
         // void a() throws a.b.c, x.y.z
         assertVisitor(visitor.visitMethod(0, "a", "()V", null, new String[] 
{"a/b/c", "x/y/z"}));
 
@@ -351,7 +357,7 @@ public class DependencyVisitorTest {
     // visitAnnotationDefault tests -------------------------------------------
 
     @Test
-    public void testVisitAnnotationDefault() {
+    void testVisitAnnotationDefault() {
         assertVisitor(mv.visitAnnotationDefault());
         assertThat(resultCollector.getDependencies()).isEmpty();
     }
@@ -359,7 +365,7 @@ public class DependencyVisitorTest {
     // visitParameterAnnotation tests 
-------------------------------------------
 
     @Test
-    public void testVisitParameterAnnotation() {
+    void testVisitParameterAnnotation() {
         // @a.b.c
         assertVisitor(mv.visitParameterAnnotation(0, "La/b/c;", false));
 
@@ -369,7 +375,7 @@ public class DependencyVisitorTest {
     // visitCode tests --------------------------------------------------------
 
     @Test
-    public void testVisitCode() {
+    void testVisitCode() {
         mv.visitCode();
 
         assertThat(resultCollector.getDependencies()).isEmpty();
@@ -378,7 +384,7 @@ public class DependencyVisitorTest {
     // visitFrame tests -------------------------------------------------------
 
     @Test
-    public void testVisitFrame() {
+    void testVisitFrame() {
         mv.visitFrame(Opcodes.F_NEW, 0, new Object[0], 0, new Object[0]);
 
         assertThat(resultCollector.getDependencies()).isEmpty();
@@ -387,7 +393,7 @@ public class DependencyVisitorTest {
     // visitInsn tests --------------------------------------------------------
 
     @Test
-    public void testVisitInsn() {
+    void testVisitInsn() {
         mv.visitInsn(Opcodes.NOP);
 
         assertThat(resultCollector.getDependencies()).isEmpty();
@@ -396,7 +402,7 @@ public class DependencyVisitorTest {
     // visitIntInsn tests -----------------------------------------------------
 
     @Test
-    public void testVisitIntInsn() {
+    void testVisitIntInsn() {
         mv.visitIntInsn(Opcodes.BIPUSH, 0);
 
         assertThat(resultCollector.getDependencies()).isEmpty();
@@ -405,7 +411,7 @@ public class DependencyVisitorTest {
     // visitVarInsn tests -----------------------------------------------------
 
     @Test
-    public void testVisitVarInsn() {
+    void testVisitVarInsn() {
         mv.visitVarInsn(Opcodes.ILOAD, 0);
 
         assertThat(resultCollector.getDependencies()).isEmpty();
@@ -414,7 +420,7 @@ public class DependencyVisitorTest {
     // visitTypeInsn tests ----------------------------------------------------
 
     @Test
-    public void testVisitTypeInsn() {
+    void testVisitTypeInsn() {
         mv.visitTypeInsn(Opcodes.NEW, "a/b/c");
 
         assertThat(resultCollector.getDependencies()).containsOnly("a.b.c");
@@ -423,14 +429,14 @@ public class DependencyVisitorTest {
     // visitFieldInsn tests ---------------------------------------------------
 
     @Test
-    public void testVisitFieldInsnWithPrimitive() {
+    void testVisitFieldInsnWithPrimitive() {
         mv.visitFieldInsn(Opcodes.GETFIELD, "a/b/c", "x", "I");
 
         assertThat(resultCollector.getDependencies()).containsOnly("a.b.c");
     }
 
     @Test
-    public void testVisitFieldInsnWithObject() {
+    void testVisitFieldInsnWithObject() {
         mv.visitFieldInsn(Opcodes.GETFIELD, "a/b/c", "x", "Lx/y/z;");
 
         assertThat(resultCollector.getDependencies()).containsOnly("a.b.c");
@@ -439,70 +445,70 @@ public class DependencyVisitorTest {
     // visitMethodInsn tests --------------------------------------------------
 
     @Test
-    public void testVisitMethodInsn() {
+    void testVisitMethodInsn() {
         mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "a/b/c", "x", "()V", false);
 
         assertThat(resultCollector.getDependencies()).containsOnly("a.b.c");
     }
 
     @Test
-    public void testVisitMethodInsnWithPrimitiveArgument() {
+    void testVisitMethodInsnWithPrimitiveArgument() {
         mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "a/b/c", "x", "(I)V", false);
 
         assertThat(resultCollector.getDependencies()).containsOnly("a.b.c");
     }
 
     @Test
-    public void testVisitMethodInsnWithPrimitiveArrayArgument() {
+    void testVisitMethodInsnWithPrimitiveArrayArgument() {
         mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "a/b/c", "x", "([I)V", 
false);
 
         assertThat(resultCollector.getDependencies()).containsOnly("a.b.c");
     }
 
     @Test
-    public void testVisitMethodInsnWithObjectArgument() {
+    void testVisitMethodInsnWithObjectArgument() {
         mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "a/b/c", "x", "(Lx/y/z;)V", 
false);
 
         assertThat(resultCollector.getDependencies()).containsOnly("a.b.c");
     }
 
     @Test
-    public void testVisitMethodInsnWithObjectArguments() {
+    void testVisitMethodInsnWithObjectArguments() {
         mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "a/b/c", "x", 
"(Lp/q/r;Lx/y/z;)V", false);
 
         assertThat(resultCollector.getDependencies()).containsOnly("a.b.c");
     }
 
     @Test
-    public void testVisitMethodInsnWithObjectArrayArgument() {
+    void testVisitMethodInsnWithObjectArrayArgument() {
         mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "a/b/c", "x", "([Lx/y/z;)V", 
false);
 
         assertThat(resultCollector.getDependencies()).containsOnly("a.b.c");
     }
 
     @Test
-    public void testVisitMethodInsnWithPrimitiveReturnType() {
+    void testVisitMethodInsnWithPrimitiveReturnType() {
         mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "a/b/c", "x", "()I", false);
 
         assertThat(resultCollector.getDependencies()).containsOnly("a.b.c");
     }
 
     @Test
-    public void testVisitMethodInsnWithPrimitiveArrayReturnType() {
+    void testVisitMethodInsnWithPrimitiveArrayReturnType() {
         mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "a/b/c", "x", "()[I", false);
 
         assertThat(resultCollector.getDependencies()).containsOnly("a.b.c");
     }
 
     @Test
-    public void testVisitMethodInsnWithObjectReturnType() {
+    void testVisitMethodInsnWithObjectReturnType() {
         mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "a/b/c", "x", "()Lx/y/z;", 
false);
 
         assertThat(resultCollector.getDependencies()).containsOnly("a.b.c");
     }
 
     @Test
-    public void testVisitMethodInsnWithObjectArrayReturnType() {
+    void testVisitMethodInsnWithObjectArrayReturnType() {
         mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "a/b/c", "x", "()[Lx/y/z;", 
false);
 
         assertThat(resultCollector.getDependencies()).containsOnly("a.b.c");
@@ -511,7 +517,7 @@ public class DependencyVisitorTest {
     // visitJumpInsn tests ----------------------------------------------------
 
     @Test
-    public void testVisitJumpInsn() {
+    void testVisitJumpInsn() {
         mv.visitJumpInsn(Opcodes.IFEQ, new Label());
 
         assertThat(resultCollector.getDependencies()).isEmpty();
@@ -520,7 +526,7 @@ public class DependencyVisitorTest {
     // visitLabel tests -------------------------------------------------------
 
     @Test
-    public void testVisitLabel() {
+    void testVisitLabel() {
         mv.visitLabel(new Label());
 
         assertThat(resultCollector.getDependencies()).isEmpty();
@@ -529,21 +535,21 @@ public class DependencyVisitorTest {
     // visitLdcInsn tests -----------------------------------------------------
 
     @Test
-    public void testVisitLdcInsnWithNonType() {
+    void testVisitLdcInsnWithNonType() {
         mv.visitLdcInsn("a");
 
         assertThat(resultCollector.getDependencies()).isEmpty();
     }
 
     @Test
-    public void testVisitLdcInsnWithPrimitiveType() {
+    void testVisitLdcInsnWithPrimitiveType() {
         mv.visitLdcInsn(Type.INT_TYPE);
 
         assertThat(resultCollector.getDependencies()).isEmpty();
     }
 
     @Test
-    public void testVisitLdcInsnWithObjectType() {
+    void testVisitLdcInsnWithObjectType() {
         mv.visitLdcInsn(Type.getType("La/b/c;"));
 
         assertThat(resultCollector.getDependencies()).containsOnly("a.b.c");
@@ -552,7 +558,7 @@ public class DependencyVisitorTest {
     // visitIincInsn tests ----------------------------------------------------
 
     @Test
-    public void testVisitIincInsn() {
+    void testVisitIincInsn() {
         mv.visitIincInsn(0, 1);
 
         assertThat(resultCollector.getDependencies()).isEmpty();
@@ -561,7 +567,7 @@ public class DependencyVisitorTest {
     // visitTableSwitchInsn tests ---------------------------------------------
 
     @Test
-    public void testVisitTableSwitchInsn() {
+    void testVisitTableSwitchInsn() {
         mv.visitTableSwitchInsn(0, 1, new Label(), new Label());
 
         assertThat(resultCollector.getDependencies()).isEmpty();
@@ -570,7 +576,7 @@ public class DependencyVisitorTest {
     // visitLookupSwitchInsn tests --------------------------------------------
 
     @Test
-    public void testVisitLookupSwitchInsn() {
+    void testVisitLookupSwitchInsn() {
         mv.visitLookupSwitchInsn(new Label(), new int[] {0}, new Label[] {new 
Label()});
 
         assertThat(resultCollector.getDependencies()).isEmpty();
@@ -579,14 +585,14 @@ public class DependencyVisitorTest {
     // visitMultiANewArrayInsn tests ------------------------------------------
 
     @Test
-    public void testVisitMultiANewArrayInsnWithPrimitive() {
+    void testVisitMultiANewArrayInsnWithPrimitive() {
         mv.visitMultiANewArrayInsn("I", 2);
 
         assertThat(resultCollector.getDependencies()).isEmpty();
     }
 
     @Test
-    public void testVisitMultiANewArrayInsnWithObject() {
+    void testVisitMultiANewArrayInsnWithObject() {
         mv.visitMultiANewArrayInsn("La/b/c;", 2);
 
         assertThat(resultCollector.getDependencies()).containsOnly("a.b.c");
@@ -595,14 +601,14 @@ public class DependencyVisitorTest {
     // visitTryCatchBlock tests -----------------------------------------------
 
     @Test
-    public void testVisitTryCatchBlock() {
+    void testVisitTryCatchBlock() {
         mv.visitTryCatchBlock(new Label(), new Label(), new Label(), "a/b/c");
 
         assertThat(resultCollector.getDependencies()).containsOnly("a.b.c");
     }
 
     @Test
-    public void testVisitTryCatchBlockForFinally() {
+    void testVisitTryCatchBlockForFinally() {
         mv.visitTryCatchBlock(new Label(), new Label(), new Label(), null);
 
         assertThat(resultCollector.getDependencies()).isEmpty();
@@ -611,42 +617,42 @@ public class DependencyVisitorTest {
     // visitLocalVariable tests -----------------------------------------------
 
     @Test
-    public void testVisitLocalVariableWithPrimitive() {
+    void testVisitLocalVariableWithPrimitive() {
         mv.visitLocalVariable("a", "I", null, new Label(), new Label(), 0);
 
         assertThat(resultCollector.getDependencies()).isEmpty();
     }
 
     @Test
-    public void testVisitLocalVariableWithPrimitiveArray() {
+    void testVisitLocalVariableWithPrimitiveArray() {
         mv.visitLocalVariable("a", "[I", null, new Label(), new Label(), 0);
 
         assertThat(resultCollector.getDependencies()).isEmpty();
     }
 
     @Test
-    public void testVisitLocalVariableWithObject() {
+    void testVisitLocalVariableWithObject() {
         mv.visitLocalVariable("a", "La/b/c;", null, new Label(), new Label(), 
0);
 
         assertThat(resultCollector.getDependencies()).containsOnly("a.b.c");
     }
 
     @Test
-    public void testVisitLocalVariableWithObjectArray() {
+    void testVisitLocalVariableWithObjectArray() {
         mv.visitLocalVariable("a", "[La/b/c;", null, new Label(), new Label(), 
0);
 
         assertThat(resultCollector.getDependencies()).containsOnly("a.b.c");
     }
 
     @Test
-    public void testVisitLocalVariableWithGenericObject() {
+    void testVisitLocalVariableWithGenericObject() {
         mv.visitLocalVariable("a", "La/b/c;", "La/b/c<Lx/y/z;>;", new Label(), 
new Label(), 0);
 
         assertThat(resultCollector.getDependencies()).containsOnly("a.b.c", 
"x.y.z");
     }
 
     @Test
-    public void testVisitLocalVariableWithGenericObjectArray() {
+    void testVisitLocalVariableWithGenericObjectArray() {
         mv.visitLocalVariable("a", "La/b/c;", "[La/b/c<Lx/y/z;>;", new 
Label(), new Label(), 0);
 
         assertThat(resultCollector.getDependencies()).containsOnly("a.b.c", 
"x.y.z");
@@ -655,7 +661,7 @@ public class DependencyVisitorTest {
     // visitLineNumber tests --------------------------------------------------
 
     @Test
-    public void testVisitLineNumber() {
+    void testVisitLineNumber() {
         mv.visitLineNumber(0, new Label());
 
         assertThat(resultCollector.getDependencies()).isEmpty();
@@ -664,7 +670,7 @@ public class DependencyVisitorTest {
     // visitMaxs tests --------------------------------------------------------
 
     @Test
-    public void testVisitMaxs() {
+    void testVisitMaxs() {
         mv.visitMaxs(0, 0);
 
         assertThat(resultCollector.getDependencies()).isEmpty();
@@ -680,7 +686,7 @@ public class DependencyVisitorTest {
      * @author <a href="mailto:markhob...@gmail.com";>Mark Hobson</a>
      */
     static class MockAttribute extends Attribute {
-        public MockAttribute(String type) {
+        MockAttribute(String type) {
             super(type);
         }
     }
diff --git 
a/src/test/java/org/apache/maven/shared/dependency/analyzer/asm/ResultCollectorTest.java
 
b/src/test/java/org/apache/maven/shared/dependency/analyzer/asm/ResultCollectorTest.java
index 7cb376e..a4fc223 100644
--- 
a/src/test/java/org/apache/maven/shared/dependency/analyzer/asm/ResultCollectorTest.java
+++ 
b/src/test/java/org/apache/maven/shared/dependency/analyzer/asm/ResultCollectorTest.java
@@ -28,11 +28,11 @@ import java.util.Set;
 import org.apache.maven.shared.dependency.analyzer.testcases.ArrayCases;
 import org.apache.maven.shared.dependency.analyzer.testcases.InnerClassCase;
 import org.apache.maven.shared.dependency.analyzer.testcases.MethodHandleCases;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-public class ResultCollectorTest {
+class ResultCollectorTest {
     Set<String> getDependencies(Class<?> inspectClass) throws IOException {
         String className = inspectClass.getName();
         String path = '/' + className.replace('.', '/') + ".class";
@@ -44,7 +44,7 @@ public class ResultCollectorTest {
     }
 
     @Test
-    public void testJava11Invoke() throws IOException {
+    void testJava11Invoke() throws IOException {
         String className = "issue362.Bcel362";
         Path path = Paths.get(
                 
"src/test/resources/org/apache/maven/shared/dependency/analyzer/commons-bcel-issue362/Bcel362.class");
@@ -55,7 +55,7 @@ public class ResultCollectorTest {
     }
 
     @Test
-    public void testArrayCases() throws IOException {
+    void testArrayCases() throws IOException {
         Set<String> dependencies = getDependencies(ArrayCases.class);
         assertThat(dependencies).doesNotContain("[I");
         assertThat(dependencies).allSatisfy(dependency -> 
assertThat(dependency).doesNotStartWith("["));
@@ -63,7 +63,7 @@ public class ResultCollectorTest {
     }
 
     @Test
-    public void testNoMethodHandle() throws IOException {
+    void testNoMethodHandle() throws IOException {
         Set<String> dependencies = getDependencies(MethodHandleCases.class);
         for (String dependency : dependencies) {
             assertThat(dependency).doesNotStartWith("(");
@@ -71,7 +71,7 @@ public class ResultCollectorTest {
     }
 
     @Test
-    public void testInnerClassAsContainer() throws IOException {
+    void testInnerClassAsContainer() throws IOException {
         Set<String> dependencies = getDependencies(InnerClassCase.class);
         for (String dependency : dependencies) {
             assertThat(dependency).doesNotContain("$");


Reply via email to