[MSHARED-1239] Switch unit tests to JUnit 5
diff --git a/pom.xml b/pom.xml
index 5ef9dea..13bd345 100644
--- a/pom.xml
+++ b/pom.xml
@@ -59,6 +59,7 @@
<mavenVersion>3.2.5</mavenVersion>
<slf4jVersion>1.7.36</slf4jVersion>
<project.build.outputTimestamp>2020-04-04T09:03:59Z</project.build.outputTimestamp>
+ <junitVersion>5.9.2</junitVersion>
</properties>
<dependencies>
@@ -108,9 +109,21 @@
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.13.2</version>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>${junitVersion}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-params</artifactId>
+ <version>${junitVersion}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-testing</artifactId>
+ <version>1.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -119,17 +132,6 @@
<version>${slf4jVersion}</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.eclipse.sisu</groupId>
- <artifactId>org.eclipse.sisu.plexus</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.google.inject</groupId>
- <artifactId>guice</artifactId>
- <version>5.1.0</version>
- <scope>test</scope>
- </dependency>
</dependencies>
diff --git a/src/test/java/org/apache/maven/shared/jar/AbstractJarAnalyzerTestCase.java b/src/test/java/org/apache/maven/shared/jar/AbstractJarAnalyzerTestCase.java
index edb4827..dab2380 100644
--- a/src/test/java/org/apache/maven/shared/jar/AbstractJarAnalyzerTestCase.java
+++ b/src/test/java/org/apache/maven/shared/jar/AbstractJarAnalyzerTestCase.java
@@ -27,21 +27,14 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import junit.framework.AssertionFailedError;
-import org.codehaus.plexus.ContainerConfiguration;
-import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusTestCase;
+import org.opentest4j.AssertionFailedError;
import static java.nio.charset.StandardCharsets.UTF_8;
/**
* Abstract JarAnalyzer TestCase
*/
-public abstract class AbstractJarAnalyzerTestCase extends PlexusTestCase {
- @Override
- protected void customizeContainerConfiguration(ContainerConfiguration configuration) {
- configuration.setAutoWiring(true).setClassPathScanning(PlexusConstants.SCANNING_CACHE);
- }
+public abstract class AbstractJarAnalyzerTestCase {
protected File getSampleJar(String filename) throws UnsupportedEncodingException {
String path = getClass().getResource("/jars/" + filename).getPath();
diff --git a/src/test/java/org/apache/maven/shared/jar/JarAnalyzerTest.java b/src/test/java/org/apache/maven/shared/jar/JarAnalyzerTest.java
index 456e602..8cac275 100644
--- a/src/test/java/org/apache/maven/shared/jar/JarAnalyzerTest.java
+++ b/src/test/java/org/apache/maven/shared/jar/JarAnalyzerTest.java
@@ -22,15 +22,22 @@
import java.io.IOException;
import java.util.zip.ZipException;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
/**
* Tests for the JarAnalyzer class.
*/
-public class JarAnalyzerTest extends AbstractJarAnalyzerTestCase {
+class JarAnalyzerTest extends AbstractJarAnalyzerTestCase {
private JarAnalyzer jarAnalyzer;
+ @AfterEach
protected void tearDown() throws Exception {
- super.tearDown();
-
if (jarAnalyzer != null) {
jarAnalyzer.closeQuietly();
}
@@ -45,40 +52,36 @@
return new JarAnalyzer(getSampleJar(filename));
}
- public void testSealed() throws Exception {
+ @Test
+ void testSealed() throws Exception {
JarData jarData = getJarData("evil-sealed-regex-1.0.jar");
assertTrue(jarData.isSealed());
}
- public void testNotSealed() throws Exception {
+ @Test
+ void testNotSealed() throws Exception {
JarData jarData = getJarData("codec.jar");
assertFalse(jarData.isSealed());
}
- public void testMissingFile() {
- try {
- jarAnalyzer = new JarAnalyzer(new File("foo-bar-this-should-not-exist.jar"));
- fail("Should not have succeeded to get the missing JAR");
- } catch (IOException e) {
- assertTrue(true);
- }
+ @Test
+ void testMissingFile() {
+ assertThrows(IOException.class, () -> new JarAnalyzer(new File("foo-bar-this-should-not-exist.jar")));
}
- public void testInvalidJarFile() throws Exception {
- try {
- getJarAnalyzer("invalid.jar");
- fail("Should not have succeeded to get the invalid JAR");
- } catch (ZipException e) {
- assertTrue(true);
- }
+ @Test
+ void testInvalidJarFile() throws Exception {
+ assertThrows(ZipException.class, () -> getJarAnalyzer("invalid.jar"));
}
- public void testCloseTwice() throws Exception {
+ @Test
+ void testCloseTwice() throws Exception {
JarAnalyzer jarAnalyzer = getJarAnalyzer("codec.jar");
// no exception should be thrown
- jarAnalyzer.closeQuietly();
- jarAnalyzer.closeQuietly();
- assertTrue(true);
+ Assertions.assertDoesNotThrow(() -> {
+ jarAnalyzer.closeQuietly();
+ jarAnalyzer.closeQuietly();
+ });
}
}
diff --git a/src/test/java/org/apache/maven/shared/jar/classes/ImportVisitorTest.java b/src/test/java/org/apache/maven/shared/jar/classes/ImportVisitorTest.java
index cd2def2..21c5c1c 100644
--- a/src/test/java/org/apache/maven/shared/jar/classes/ImportVisitorTest.java
+++ b/src/test/java/org/apache/maven/shared/jar/classes/ImportVisitorTest.java
@@ -27,12 +27,18 @@
import org.apache.bcel.classfile.DescendingVisitor;
import org.apache.bcel.classfile.JavaClass;
import org.apache.maven.shared.jar.AbstractJarAnalyzerTestCase;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Import Visitor Test
*/
-public class ImportVisitorTest extends AbstractJarAnalyzerTestCase {
- public void testImportsJxr() throws ClassFormatException, IOException {
+class ImportVisitorTest extends AbstractJarAnalyzerTestCase {
+
+ @Test
+ void testImportsJxr() throws ClassFormatException, IOException {
File jxrjar = getSampleJar("jxr.jar");
String classname = "org/apache/maven/jxr/DirectoryIndexer.class";
ClassParser classParser = new ClassParser(jxrjar.getAbsolutePath(), classname);
@@ -43,15 +49,16 @@
javaClass.accept(descVisitor);
List<String> imports = importVisitor.getImports();
- assertNotNull("Import List", imports);
+ assertNotNull(imports, "Import List");
assertNotContainsRegex("Import List", "[\\[\\)\\(\\;]", imports);
- assertTrue("imports", imports.contains("org.apache.maven.jxr.pacman.PackageType"));
- assertTrue("imports", imports.contains("org.apache.oro.text.perl.Perl5Util"));
+ assertTrue(imports.contains("org.apache.maven.jxr.pacman.PackageType"), "imports");
+ assertTrue(imports.contains("org.apache.oro.text.perl.Perl5Util"), "imports");
}
- public void testImportsAnt() throws ClassFormatException, IOException {
+ @Test
+ void testImportsAnt() throws ClassFormatException, IOException {
File jxrjar = getSampleJar("ant.jar");
String classname = "org/apache/tools/ant/Target.class";
ClassParser classParser = new ClassParser(jxrjar.getAbsolutePath(), classname);
@@ -62,11 +69,11 @@
javaClass.accept(descVisitor);
List<String> imports = importVisitor.getImports();
- assertNotNull("Import List", imports);
+ assertNotNull(imports, "Import List");
assertNotContainsRegex("Import List", "[\\[\\)\\(\\;]", imports);
- assertTrue("imports", imports.contains("org.apache.tools.ant.Location"));
- assertTrue("imports", imports.contains("org.apache.tools.ant.Task"));
+ assertTrue(imports.contains("org.apache.tools.ant.Location"), "imports");
+ assertTrue(imports.contains("org.apache.tools.ant.Task"), "imports");
}
}
diff --git a/src/test/java/org/apache/maven/shared/jar/classes/JarClassesAnalyzerTest.java b/src/test/java/org/apache/maven/shared/jar/classes/JarClassesAnalyzerTest.java
index 60252b5..e2b9fd2 100644
--- a/src/test/java/org/apache/maven/shared/jar/classes/JarClassesAnalyzerTest.java
+++ b/src/test/java/org/apache/maven/shared/jar/classes/JarClassesAnalyzerTest.java
@@ -18,56 +18,68 @@
*/
package org.apache.maven.shared.jar.classes;
+import javax.inject.Inject;
+
import java.io.File;
import org.apache.maven.shared.jar.AbstractJarAnalyzerTestCase;
import org.apache.maven.shared.jar.JarAnalyzer;
+import org.codehaus.plexus.testing.PlexusTest;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* JarAnalyzer Classes Test Case
*/
-public class JarClassesAnalyzerTest extends AbstractJarAnalyzerTestCase {
+@PlexusTest
+class JarClassesAnalyzerTest extends AbstractJarAnalyzerTestCase {
+
+ @Inject
private JarClassesAnalysis analyzer;
- public void setUp() throws Exception {
- super.setUp();
-
- analyzer = (JarClassesAnalysis) lookup(JarClassesAnalysis.class.getName());
- }
-
- public void testAnalyzeJXR() throws Exception {
+ @Test
+ void testAnalyzeJXR() throws Exception {
JarClasses jclass = getJarClasses("jxr.jar");
- assertFalse("classes.imports.length > 0", jclass.getImports().isEmpty());
- assertFalse("classes.packages.length > 0", jclass.getPackages().isEmpty());
- assertFalse("classes.methods.length > 0", jclass.getMethods().isEmpty());
+ assertFalse(jclass.getImports().isEmpty(), "classes.imports.length > 0");
+ assertFalse(jclass.getPackages().isEmpty(), "classes.packages.length > 0");
+ assertFalse(jclass.getMethods().isEmpty(), "classes.methods.length > 0");
assertNotContainsRegex("Import List", "[\\[\\)\\(\\;]", jclass.getImports());
// TODO: test for classes, methods, etc.
- assertTrue("classes.imports", jclass.getImports().contains("org.apache.maven.jxr.JXR"));
- assertTrue("classes.imports", jclass.getImports().contains("org.apache.oro.text.perl.Perl5Util"));
- assertTrue("classes.packages", jclass.getPackages().contains("org.apache.maven.jxr.pacman"));
+ assertTrue(jclass.getImports().contains("org.apache.maven.jxr.JXR"), "classes.imports");
+ assertTrue(jclass.getImports().contains("org.apache.oro.text.perl.Perl5Util"), "classes.imports");
+ assertTrue(jclass.getPackages().contains("org.apache.maven.jxr.pacman"), "classes.packages");
}
- public void testAnalyzeANT() throws Exception {
+ @Test
+ void testAnalyzeANT() throws Exception {
JarClasses jclass = getJarClasses("ant.jar");
- assertFalse("classes.imports.length > 0", jclass.getImports().isEmpty());
- assertFalse("classes.packages.length > 0", jclass.getPackages().isEmpty());
- assertFalse("classes.methods.length > 0", jclass.getMethods().isEmpty());
+ assertFalse(jclass.getImports().isEmpty(), "classes.imports.length > 0");
+ assertFalse(jclass.getPackages().isEmpty(), "classes.packages.length > 0");
+ assertFalse(jclass.getMethods().isEmpty(), "classes.methods.length > 0");
assertNotContainsRegex("Import List", "[\\[\\)\\(\\;]", jclass.getImports());
- assertTrue("classes.imports", jclass.getImports().contains("java.util.zip.GZIPInputStream"));
- assertTrue("classes.imports", jclass.getImports().contains("org.apache.tools.ant.XmlLogger$TimedElement"));
- assertTrue("classes.imports", jclass.getImports().contains("org.apache.tools.mail.MailMessage"));
- assertTrue("classes.packages", jclass.getPackages().contains("org.apache.tools.ant"));
- assertTrue("classes.packages", jclass.getPackages().contains("org.apache.tools.bzip2"));
+ assertTrue(jclass.getImports().contains("java.util.zip.GZIPInputStream"), "classes.imports");
+ assertTrue(jclass.getImports().contains("org.apache.tools.ant.XmlLogger$TimedElement"), "classes.imports");
+ assertTrue(jclass.getImports().contains("org.apache.tools.mail.MailMessage"), "classes.imports");
+ assertTrue(jclass.getPackages().contains("org.apache.tools.ant"), "classes.packages");
+ assertTrue(jclass.getPackages().contains("org.apache.tools.bzip2"), "classes.packages");
}
- public void testAnalyzeJarWithInvalidClassFile() throws Exception {
+ @Test
+ void testAnalyzeJarWithInvalidClassFile() throws Exception {
JarClasses jclass = getJarClasses("invalid-class-file.jar");
// Doesn't fail, as exceptions are ignored.
@@ -78,71 +90,46 @@
assertTrue(jclass.getMethods().isEmpty());
}
- public void testAnalyzeJarWithDebug() throws Exception {
+ @Test
+ void testAnalyzeJarWithDebug() throws Exception {
JarClasses jclass = getJarClasses("helloworld-1.4-debug.jar");
- assertTrue("has debug", jclass.isDebugPresent());
+ assertTrue(jclass.isDebugPresent(), "has debug");
}
- public void testAnalyzeJarWithoutDebug() throws Exception {
+ @Test
+ void testAnalyzeJarWithoutDebug() throws Exception {
JarClasses jclass = getJarClasses("helloworld-1.4.jar");
- assertFalse("no debug present", jclass.isDebugPresent());
+ assertFalse(jclass.isDebugPresent(), "no debug present");
}
- public void testAnalyzeJarVersion18() throws Exception {
- JarClasses jclass = getJarClasses("helloworld-1.8.jar");
-
- assertEquals("jdkrevision", "1.8", jclass.getJdkRevision());
+ static String[][] testAnalyzeJarVersion() {
+ return new String[][] {
+ {"helloworld-1.1.jar", "1.1"},
+ {"helloworld-1.2.jar", "1.2"},
+ {"helloworld-1.3.jar", "1.3"},
+ {"helloworld-1.4.jar", "1.4"},
+ {"helloworld-1.5.jar", "1.5"},
+ {"helloworld-1.6.jar", "1.6"},
+ {"helloworld-1.7.jar", "1.7"},
+ {"helloworld-1.8.jar", "1.8"}
+ };
}
- public void testAnalyzeJarVersion17() throws Exception {
- JarClasses jclass = getJarClasses("helloworld-1.7.jar");
+ @ParameterizedTest
+ @MethodSource
+ void testAnalyzeJarVersion(String jarName, String expectedRevision) throws Exception {
+ JarClasses jclass = getJarClasses(jarName);
- assertEquals("jdkrevision", "1.7", jclass.getJdkRevision());
- }
-
- public void testAnalyzeJarVersion16() throws Exception {
- JarClasses jclass = getJarClasses("helloworld-1.6.jar");
-
- assertEquals("jdkrevision", "1.6", jclass.getJdkRevision());
- }
-
- public void testAnalyzeJarVersion15() throws Exception {
- JarClasses jclass = getJarClasses("helloworld-1.5.jar");
-
- assertEquals("jdkrevision", "1.5", jclass.getJdkRevision());
- }
-
- public void testAnalyzeJarVersion14() throws Exception {
- JarClasses jclass = getJarClasses("helloworld-1.4.jar");
-
- assertEquals("jdkrevision", "1.4", jclass.getJdkRevision());
- }
-
- public void testAnalyzeJarVersion13() throws Exception {
- JarClasses jclass = getJarClasses("helloworld-1.3.jar");
-
- assertEquals("jdkrevision", "1.3", jclass.getJdkRevision());
- }
-
- public void testAnalyzeJarVersion12() throws Exception {
- JarClasses jclass = getJarClasses("helloworld-1.2.jar");
-
- assertEquals("jdkrevision", "1.2", jclass.getJdkRevision());
- }
-
- public void testAnalyzeJarVersion11() throws Exception {
- JarClasses jclass = getJarClasses("helloworld-1.1.jar");
-
- assertEquals("jdkrevision", "1.1", jclass.getJdkRevision());
+ assertEquals(expectedRevision, jclass.getJdkRevision());
}
private JarClasses getJarClasses(String filename) throws Exception {
File file = getSampleJar(filename);
JarClasses jclass = analyzer.analyze(new JarAnalyzer(file));
- assertNotNull("JarClasses", jclass);
+ assertNotNull(jclass, "JarClasses");
return jclass;
}
diff --git a/src/test/java/org/apache/maven/shared/jar/identification/JarIdentificationAnalyzerTest.java b/src/test/java/org/apache/maven/shared/jar/identification/JarIdentificationAnalyzerTest.java
index ca8ed21..33f706c 100644
--- a/src/test/java/org/apache/maven/shared/jar/identification/JarIdentificationAnalyzerTest.java
+++ b/src/test/java/org/apache/maven/shared/jar/identification/JarIdentificationAnalyzerTest.java
@@ -18,36 +18,45 @@
*/
package org.apache.maven.shared.jar.identification;
+import javax.inject.Inject;
+
import java.io.File;
import org.apache.maven.shared.jar.AbstractJarAnalyzerTestCase;
import org.apache.maven.shared.jar.JarAnalyzer;
+import org.codehaus.plexus.testing.PlexusTest;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
/**
* JarAnalyzer Taxon Analyzer Test Case
- *
* TODO test the exposers individually instead of in aggregate here (and test the normalize, etc. methods here instead with controlled exposers)
*/
-public class JarIdentificationAnalyzerTest extends AbstractJarAnalyzerTestCase {
+@PlexusTest
+class JarIdentificationAnalyzerTest extends AbstractJarAnalyzerTestCase {
+
+ @Inject
+ JarIdentificationAnalysis analyzer;
+
private JarIdentification getJarTaxon(String filename) throws Exception {
File jarfile = getSampleJar(filename);
-
- JarIdentificationAnalysis analyzer =
- (JarIdentificationAnalysis) lookup(JarIdentificationAnalysis.class.getName());
JarIdentification taxon = analyzer.analyze(new JarAnalyzer(jarfile));
- assertNotNull("JarIdentification", taxon);
-
+ assertNotNull(taxon, "JarIdentification");
return taxon;
}
- public void testTaxonAnalyzerWithJXR() throws Exception {
+ @Test
+ void testTaxonAnalyzerWithJXR() throws Exception {
JarIdentification taxon = getJarTaxon("jxr.jar");
- assertEquals("identification.groupId", "org.apache.maven", taxon.getGroupId());
- assertEquals("identification.artifactId", "maven-jxr", taxon.getArtifactId());
- assertEquals("identification.version", "1.1-SNAPSHOT", taxon.getVersion());
- assertEquals("identification.name", "Maven JXR", taxon.getName());
- assertEquals("identification.vendor", "Apache Software Foundation", taxon.getVendor());
+ assertEquals("org.apache.maven", taxon.getGroupId(), "identification.groupId");
+ assertEquals("maven-jxr", taxon.getArtifactId(), "identification.artifactId");
+ assertEquals("1.1-SNAPSHOT", taxon.getVersion(), "identification.version");
+ assertEquals("Maven JXR", taxon.getName(), "identification.name");
+ assertEquals("Apache Software Foundation", taxon.getVendor(), "identification.vendor");
// TODO assert potentials too
}
@@ -57,30 +66,32 @@
*
* @throws Exception failures
*/
- public void testTaxonAnalyzerWithCODEC() throws Exception {
+ @Test
+ void testTaxonAnalyzerWithCODEC() throws Exception {
JarIdentification taxon = getJarTaxon("codec.jar");
- assertEquals("identification.groupId", "org.apache.commons.codec", taxon.getGroupId());
- assertEquals("identification.artifactId", "codec", taxon.getArtifactId());
+ assertEquals("org.apache.commons.codec", taxon.getGroupId(), "identification.groupId");
+ assertEquals("codec", taxon.getArtifactId(), "identification.artifactId");
// TODO fix assertion
// assertEquals( "identification.version", "codec_release_1_0_0_interim_20030519095102_build",
// identification.getVersion() );
- assertEquals("identification.version", "20030519", taxon.getVersion());
- assertEquals("identification.name", "codec", taxon.getName());
- assertNull("identification.vendor", taxon.getVendor());
+ assertEquals("20030519", taxon.getVersion(), "identification.version");
+ assertEquals("codec", taxon.getName(), "identification.name");
+ assertNull(taxon.getVendor(), "identification.vendor");
// TODO assert potentials too
}
- public void testTaxonAnalyzerWithANT() throws Exception {
+ @Test
+ void testTaxonAnalyzerWithANT() throws Exception {
JarIdentification taxon = getJarTaxon("ant.jar");
- assertEquals("identification.groupId", "org.apache.tools.ant", taxon.getGroupId());
- assertEquals("identification.artifactId", "ant", taxon.getArtifactId());
- assertEquals("identification.version", "1.6.5", taxon.getVersion());
+ assertEquals("org.apache.tools.ant", taxon.getGroupId(), "identification.groupId");
+ assertEquals("ant", taxon.getArtifactId(), "identification.artifactId");
+ assertEquals("1.6.5", taxon.getVersion(), "identification.version");
// TODO fix assertion
// assertEquals( "identification.name", "Apache Ant", identification.getName() );
- assertEquals("identification.vendor", "Apache Software Foundation", taxon.getVendor());
+ assertEquals("Apache Software Foundation", taxon.getVendor(), "identification.vendor");
// TODO assert potentials too
}
diff --git a/src/test/java/org/apache/maven/shared/jar/identification/exposers/EmbeddedMavenModelExposerTest.java b/src/test/java/org/apache/maven/shared/jar/identification/exposers/EmbeddedMavenModelExposerTest.java
index 9940d07..aae04c8 100644
--- a/src/test/java/org/apache/maven/shared/jar/identification/exposers/EmbeddedMavenModelExposerTest.java
+++ b/src/test/java/org/apache/maven/shared/jar/identification/exposers/EmbeddedMavenModelExposerTest.java
@@ -23,12 +23,19 @@
import org.apache.maven.shared.jar.AbstractJarAnalyzerTestCase;
import org.apache.maven.shared.jar.JarAnalyzer;
import org.apache.maven.shared.jar.identification.JarIdentification;
+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;
/**
* Test Case for Embedded Maven Model Taxon Data.
*/
-public class EmbeddedMavenModelExposerTest extends AbstractJarAnalyzerTestCase {
- public void testExposerWithParent() throws Exception {
+class EmbeddedMavenModelExposerTest extends AbstractJarAnalyzerTestCase {
+
+ @Test
+ void testExposerWithParent() throws Exception {
File file = getSampleJar("test1.jar");
JarIdentification identification = new JarIdentification();
@@ -46,7 +53,8 @@
assertEquals("1.1-SNAPSHOT", identification.getPotentialVersions().get(0));
}
- public void testExposerWithJXR() throws Exception {
+ @Test
+ void testExposerWithJXR() throws Exception {
File file = getSampleJar("jxr.jar");
JarIdentification identification = new JarIdentification();
@@ -54,15 +62,15 @@
EmbeddedMavenModelExposer exposer = new EmbeddedMavenModelExposer();
exposer.expose(identification, new JarAnalyzer(file));
- assertFalse("exposer.groupIds", identification.getPotentialGroupIds().isEmpty());
- assertFalse(
- "exposer.artifactIds", identification.getPotentialArtifactIds().isEmpty());
- assertFalse("exposer.versions", identification.getPotentialVersions().isEmpty());
+ assertFalse(identification.getPotentialGroupIds().isEmpty(), "exposer.groupIds");
+ assertFalse(identification.getPotentialArtifactIds().isEmpty(), "exposer.artifactIds");
+ assertFalse(identification.getPotentialVersions().isEmpty(), "exposer.versions");
// TODO test others
}
- public void testExposerWithANT() throws Exception {
+ @Test
+ void testExposerWithANT() throws Exception {
File file = getSampleJar("ant.jar");
JarIdentification identification = new JarIdentification();
@@ -70,10 +78,9 @@
EmbeddedMavenModelExposer exposer = new EmbeddedMavenModelExposer();
exposer.expose(identification, new JarAnalyzer(file));
- assertTrue("exposer.groupIds", identification.getPotentialGroupIds().isEmpty());
- assertTrue(
- "exposer.artifactIds", identification.getPotentialArtifactIds().isEmpty());
- assertTrue("exposer.versions", identification.getPotentialVersions().isEmpty());
+ assertTrue(identification.getPotentialGroupIds().isEmpty(), "exposer.groupIds");
+ assertTrue(identification.getPotentialArtifactIds().isEmpty(), "exposer.artifactIds");
+ assertTrue(identification.getPotentialVersions().isEmpty(), "exposer.versions");
// TODO test others
}