Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,26 @@ public abstract class AbstractFilenameModuleNameExtractorTest {
protected abstract ModuleNameExtractor getExtractor();

@Test
void testJarWithoutManifest() throws Exception {
void jarWithoutManifest() throws Exception {
String name = getExtractor().extract(Paths.get("src/test/test-data/jar.empty/plexus-java-1.0.0-SNAPSHOT.jar"));
assertEquals("plexus.java", name);
}

@Test
void testJarWithManifest() throws Exception {
void jarWithManifest() throws Exception {
String name = getExtractor()
.extract(Paths.get("src/test/test-data/jar.manifest.with/plexus-java-1.0.0-SNAPSHOT.jar"));
assertEquals("org.codehaus.plexus.languages.java", name);
}

@Test
void testJarUnsupported() throws Exception {
void jarUnsupported() throws Exception {
String name = getExtractor().extract(Paths.get("src/test/test-data/jar.unsupported/jdom-1.0.jar"));
assertNull(name);
}

@Test
void testJarWithSpacesInPath() throws Exception {
void jarWithSpacesInPath() throws Exception {
String name = getExtractor()
.extract(Paths.get("src/test/test-data/jar with spaces in path/plexus-java-1.0.0-SNAPSHOT.jar"));
assertEquals("org.codehaus.plexus.languages.java", name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class BinaryModuleInfoParserTest {
private final BinaryModuleInfoParser parser = new BinaryModuleInfoParser();

@Test
void testJarDescriptor() throws Exception {
void jarDescriptor() throws Exception {
JavaModuleDescriptor descriptor =
parser.getModuleDescriptor(Paths.get("src/test/test-data/jar.descriptor/asm-6.0_BETA.jar"));

Expand All @@ -67,7 +67,7 @@ void testJarDescriptor() throws Exception {
}

@Test
void testMultiReleaseJarDescriptor() throws Exception {
void multiReleaseJarDescriptor() throws Exception {
JavaModuleDescriptor descriptor = parser.getModuleDescriptor(
Paths.get("src/test/test-data/jar.mr.descriptor/jloadr-1.0-SNAPSHOT.jar"), JavaVersion.parse("17"));

Expand All @@ -77,7 +77,7 @@ void testMultiReleaseJarDescriptor() throws Exception {
}

@Test
void testIncompleteMultiReleaseJarDescriptor() throws Exception {
void incompleteMultiReleaseJarDescriptor() throws Exception {
// this jar is missing the Multi-Release: true entry in the Manifest
JavaModuleDescriptor descriptor = parser.getModuleDescriptor(
Paths.get("src/test/test-data/jar.mr.incomplete.descriptor/jloadr-1.0-SNAPSHOT.jar"));
Expand All @@ -86,15 +86,15 @@ void testIncompleteMultiReleaseJarDescriptor() throws Exception {
}

@Test
void testClassicJar() throws Exception {
void classicJar() throws Exception {
JavaModuleDescriptor descriptor =
parser.getModuleDescriptor(Paths.get("src/test/test-data/jar.empty/plexus-java-1.0.0-SNAPSHOT.jar"));

assertNull(descriptor);
}

@Test
void testOutputDirectoryDescriptor() throws Exception {
void outputDirectoryDescriptor() throws Exception {
JavaModuleDescriptor descriptor =
parser.getModuleDescriptor(Paths.get("src/test/test-data/dir.descriptor/out"));

Expand All @@ -115,14 +115,14 @@ void testOutputDirectoryDescriptor() throws Exception {
}

@Test
void testClassicOutputDirectory() {
void classicOutputDirectory() {
assertThrows(
NoSuchFileException.class,
() -> parser.getModuleDescriptor(Paths.get("src/test/test-data/dir.empty/out")));
}

@Test
void testJModDescriptor() throws Exception {
void jModDescriptor() throws Exception {
JavaModuleDescriptor descriptor = parser.getModuleDescriptor(
Paths.get("src/test/test-data/jmod.descriptor/first-jmod-1.0-SNAPSHOT.jmod"));

Expand All @@ -139,13 +139,13 @@ void testJModDescriptor() throws Exception {
}

@Test
void testInvalidFile() {
void invalidFile() {
assertThrows(
IOException.class, () -> parser.getModuleDescriptor(Paths.get("src/test/test-data/nonjar/pom.xml")));
}

@Test
void testUses() throws Exception {
void uses() throws Exception {
try (InputStream is =
Files.newInputStream(Paths.get("src/test/test-data/dir.descriptor.uses/out/module-info.class"))) {
JavaModuleDescriptor descriptor = parser.parse(is);
Expand All @@ -161,7 +161,7 @@ void testUses() throws Exception {
}

@Test
void testProvides() throws Exception {
void provides() throws Exception {
JavaModuleDescriptor descriptor =
parser.getModuleDescriptor(Paths.get("src/test/test-data/jar.service/threeten-extra-1.4.jar"));

Expand All @@ -186,7 +186,7 @@ void testProvides() throws Exception {
}

@Test
void testRequires() throws Exception {
void requires() throws Exception {
try (InputStream is =
Files.newInputStream(Paths.get("src/test/test-data/dir.descriptor.requires/out/module-info.class"))) {
JavaModuleDescriptor descriptor = parser.parse(is);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

class CmdModuleNameExtractorTest {
@Test
void testMethodCount() throws Exception {
void methodCount() throws Exception {
// ensure that both implementations are in sync
assertThat(CmdModuleNameExtractor.class.getDeclaredMethods()).hasSize(2);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ ModuleInfoParser getBinaryModuleInfoParser(Path jdkHome) {
}

@Test
void testManifestWithoutReflectRequires() throws Exception {
void manifestWithoutReflectRequires() throws Exception {
Path abc = Paths.get("src/test/test-data/manifest.without/out");
JavaModuleDescriptor descriptor =
JavaModuleDescriptor.newModule("base").requires("any").build();
Expand All @@ -84,7 +84,7 @@ void testManifestWithoutReflectRequires() throws Exception {
}

@Test
void testEmptyWithReflectRequires() throws Exception {
void emptyWithReflectRequires() throws Exception {
Path abc = Paths.get("src/test/test-data/empty/out");
JavaModuleDescriptor descriptor =
JavaModuleDescriptor.newModule("base").requires("a.b.c").build();
Expand All @@ -102,17 +102,14 @@ void testEmptyWithReflectRequires() throws Exception {
}

@Test
void testResolvePathWithException() {
assertThrows(RuntimeException.class, () -> {
Path p = Paths.get("src/test/test-data/jar.empty.invalid.name/101-1.0.0-SNAPSHOT.jar");
ResolvePathRequest<Path> request = ResolvePathRequest.ofPath(p);

locationManager.resolvePath(request);
});
void resolvePathWithException() {
Path p = Paths.get("src/test/test-data/jar.empty.invalid.name/101-1.0.0-SNAPSHOT.jar");
ResolvePathRequest<Path> request = ResolvePathRequest.ofPath(p);
assertThrows(RuntimeException.class, () -> locationManager.resolvePath(request));
}

@Test
void testClassicJarNameStartsWithNumber() throws Exception {
void classicJarNameStartsWithNumber() throws Exception {
Path p = Paths.get("src/test/test-data/jar.empty.invalid.name/101-1.0.0-SNAPSHOT.jar");
ResolvePathsRequest<Path> request =
ResolvePathsRequest.ofPaths(Collections.singletonList(p)).setMainModuleDescriptor(mockModuleInfoJava);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ ModuleInfoParser getBinaryModuleInfoParser(Path jdkHome) {
}

@Test
void testNoPaths() throws Exception {
void noPaths() throws Exception {
ResolvePathsResult<File> result =
locationManager.resolvePaths(ResolvePathsRequest.ofFiles(Collections.emptyList()));
assertThat(result.getMainModuleDescriptor()).isNull();
Expand All @@ -68,7 +68,7 @@ void testNoPaths() throws Exception {
}

@Test
void testWithUnknownRequires() throws Exception {
void withUnknownRequires() throws Exception {
JavaModuleDescriptor descriptor = JavaModuleDescriptor.newModule("base")
.requires("java.base")
.requires("jdk.net")
Expand All @@ -87,7 +87,7 @@ void testWithUnknownRequires() throws Exception {
}

@Test
void testManifestWithReflectRequires() throws Exception {
void manifestWithReflectRequires() throws Exception {
Path abc = Paths.get("src/test/test-data/dir.manifest.with/out");
JavaModuleDescriptor descriptor = JavaModuleDescriptor.newModule("base")
.requires("auto.by.manifest")
Expand All @@ -107,7 +107,7 @@ void testManifestWithReflectRequires() throws Exception {
}

@Test
void testDirDescriptorWithReflectRequires() throws Exception {
void dirDescriptorWithReflectRequires() throws Exception {
Path abc = Paths.get("src/test/test-data/dir.descriptor/out");
JavaModuleDescriptor descriptor = JavaModuleDescriptor.newModule("base")
.requires("dir.descriptor")
Expand All @@ -130,7 +130,7 @@ void testDirDescriptorWithReflectRequires() throws Exception {
}

@Test
void testJarWithAsmRequires() throws Exception {
void jarWithAsmRequires() throws Exception {
Path abc = Paths.get("src/test/test-data/jar.descriptor/asm-6.0_BETA.jar");
JavaModuleDescriptor descriptor = JavaModuleDescriptor.newModule("base")
.requires("org.objectweb.asm")
Expand All @@ -152,7 +152,7 @@ void testJarWithAsmRequires() throws Exception {
}

@Test
void testIdenticalModuleNames() throws Exception {
void identicalModuleNames() throws Exception {
Path pj1 = Paths.get("src/test/test-data/jar.empty/plexus-java-1.0.0-SNAPSHOT.jar");
Path pj2 = Paths.get("src/test/test-data/jar.empty.2/plexus-java-2.0.0-SNAPSHOT.jar");
JavaModuleDescriptor descriptor =
Expand Down Expand Up @@ -182,7 +182,7 @@ void testIdenticalModuleNames() throws Exception {
}

@Test
public void testIdenticalAutomaticModuleNames() throws Exception {
void identicalAutomaticModuleNames() throws Exception {
Path pj1 = Paths.get("src/test/test-data/jar.empty/plexus-java-1.0.0-SNAPSHOT.jar");
Path pj2 = Paths.get("src/test/test-data/jar.empty.2/plexus-java-2.0.0-SNAPSHOT.jar");
JavaModuleDescriptor descriptor =
Expand Down Expand Up @@ -212,7 +212,7 @@ public void testIdenticalAutomaticModuleNames() throws Exception {
}

@Test
public void testMainJarModuleAndTestJarAutomatic() throws Exception {
void mainJarModuleAndTestJarAutomatic() throws Exception {
Path pj1 = Paths.get("src/test/test-data/jar.tests/plexus-java-1.0.0-SNAPSHOT.jar");
Path pj2 = Paths.get("src/test/test-data/jar.tests/plexus-java-1.0.0-SNAPSHOT-tests.jar");
JavaModuleDescriptor descriptor =
Expand Down Expand Up @@ -242,7 +242,7 @@ public void testMainJarModuleAndTestJarAutomatic() throws Exception {
}

@Test
void testNonJar() throws Exception {
void nonJar() throws Exception {
Path p = Paths.get("src/test/test-data/nonjar/pom.xml");

ResolvePathsRequest<Path> request =
Expand All @@ -254,7 +254,7 @@ void testNonJar() throws Exception {
}

@Test
void testAdditionalModules() throws Exception {
void additionalModules() throws Exception {
Path p = Paths.get("src/test/test-data/mock/jar0.jar");

JavaModuleDescriptor descriptor = JavaModuleDescriptor.newModule("base").build();
Expand All @@ -276,7 +276,7 @@ void testAdditionalModules() throws Exception {
}

@Test
void testResolvePath() throws Exception {
void resolvePath() throws Exception {
Path abc = Paths.get("src/test/test-data/mock/jar0.jar");
ResolvePathRequest<Path> request = ResolvePathRequest.ofPath(abc);

Expand All @@ -291,7 +291,7 @@ void testResolvePath() throws Exception {
}

@Test
void testNoMatchingProviders() throws Exception {
void noMatchingProviders() throws Exception {
Path abc = Paths.get("src/test/test-data/mock/module-info.java"); // some file called module-info.java
Path def = Paths.get("src/test/test-data/mock/jar0.jar"); // any existing file
ResolvePathsRequest<Path> request =
Expand All @@ -312,7 +312,7 @@ void testNoMatchingProviders() throws Exception {
}

@Test
void testMainModuleDescriptorWithProviders() throws Exception {
void mainModuleDescriptorWithProviders() throws Exception {
Path abc = Paths.get("src/test/test-data/mock/module-info.java"); // some file called module-info.java
Path def = Paths.get("src/test/test-data/mock/jar0.jar"); // any existing file
ResolvePathsRequest<Path> request =
Expand All @@ -333,7 +333,7 @@ void testMainModuleDescriptorWithProviders() throws Exception {
}

@Test
void testMainModuleDescriptorWithProvidersDontIncludeProviders() throws Exception {
void mainModuleDescriptorWithProvidersDontIncludeProviders() throws Exception {
Path abc = Paths.get("src/test/test-data/mock/module-info.java"); // some file called module-info.java
Path def = Paths.get("src/test/test-data/mock/jar0.jar"); // any existing file
ResolvePathsRequest<Path> request = ResolvePathsRequest.ofPaths(def).setMainModuleDescriptor(abc);
Expand All @@ -353,7 +353,7 @@ void testMainModuleDescriptorWithProvidersDontIncludeProviders() throws Exceptio
}

@Test
void testTransitiveProviders() throws Exception {
void transitiveProviders() throws Exception {
Path abc = Paths.get("src/test/test-data/mock/module-info.java"); // some file called module-info.java
Path def = Paths.get("src/test/test-data/mock/jar0.jar"); // any existing file
Path ghi = Paths.get("src/test/test-data/mock/jar1.jar"); // any existing file
Expand All @@ -379,7 +379,7 @@ void testTransitiveProviders() throws Exception {
}

@Test
void testDontIncludeProviders() throws Exception {
void dontIncludeProviders() throws Exception {
Path abc = Paths.get("src/test/test-data/mock/module-info.java"); // some file called module-info.java
Path def = Paths.get("src/test/test-data/mock/jar0.jar"); // any existing file
Path ghi = Paths.get("src/test/test-data/mock/jar1.jar"); // any existing file
Expand All @@ -404,7 +404,7 @@ void testDontIncludeProviders() throws Exception {
}

@Test
void testAllowAdditionalModulesWithoutMainDescriptor() throws Exception {
void allowAdditionalModulesWithoutMainDescriptor() throws Exception {
Path def = Paths.get("src/test/test-data/mock/jar0.jar"); // any existing file
Path ghi = Paths.get("src/test/test-data/mock/jar1.jar"); // any existing file
ResolvePathsRequest<Path> request =
Expand All @@ -423,7 +423,7 @@ void testAllowAdditionalModulesWithoutMainDescriptor() throws Exception {
}

@Test
void testReuseModuleDescriptor() throws Exception {
void reuseModuleDescriptor() throws Exception {
Path def = Paths.get("src/test/test-data/mock/jar0.jar");

ResolvePathRequest<Path> request1 = ResolvePathRequest.ofPath(def);
Expand All @@ -441,7 +441,7 @@ void testReuseModuleDescriptor() throws Exception {
}

@Test
void testParseModuleDescriptor() throws Exception {
void parseModuleDescriptor() throws Exception {
Path descriptorPath = Paths.get("src/test/test-data/src.dir/module-info.java");
when(qdoxParser.fromSourcePath(descriptorPath))
.thenReturn(JavaModuleDescriptor.newModule("a.b.c").build());
Expand All @@ -460,7 +460,7 @@ void testParseModuleDescriptor() throws Exception {
}

@Test
void testTransitiveStatic() throws Exception {
void transitiveStatic() throws Exception {
Path moduleA = Paths.get("src/test/test-data/mock/module-info.java"); // some file called module-info.java
Path moduleB = Paths.get("src/test/test-data/mock/jar0.jar"); // any existing file
Path moduleC = Paths.get("src/test/test-data/mock/jar1.jar"); // any existing file
Expand All @@ -486,7 +486,7 @@ void testTransitiveStatic() throws Exception {
}

@Test
void testDirectStatic() throws Exception {
void directStatic() throws Exception {
Path moduleA = Paths.get("src/test/test-data/mock/module-info.java"); // some file called module-info.java
Path moduleB = Paths.get("src/test/test-data/mock/jar0.jar"); // any existing file
Path moduleC = Paths.get("src/test/test-data/mock/jar1.jar"); // any existing file
Expand Down Expand Up @@ -517,7 +517,7 @@ void testDirectStatic() throws Exception {
}

@Test
void testDuplicateModule() throws Exception {
void duplicateModule() throws Exception {
Path moduleA = Paths.get("src/test/test-data/mock/module-info.java"); // some file called module-info.java
Path moduleB = Paths.get("src/test/test-data/mock/jar0.jar"); // any existing file
Path moduleC = Paths.get("src/test/test-data/mock/jar1.jar"); // any existing file
Expand Down Expand Up @@ -547,7 +547,7 @@ void testDuplicateModule() throws Exception {
}

@Test
void testStaticTransitive() throws Exception {
void staticTransitive() throws Exception {
Path moduleA = Paths.get("src/test/test-data/mock/module-info.java"); // some file called module-info.java
Path moduleB = Paths.get("src/test/test-data/mock/jar0.jar"); // any existing file
Path moduleC = Paths.get("src/test/test-data/mock/jar1.jar"); // any existing file
Expand Down
Loading