This commit is contained in:
Andrey Nazarov 2017-04-20 22:46:22 -07:00
commit ca5924c51b
2 changed files with 53 additions and 0 deletions

View File

@ -149,6 +149,23 @@ public class BindServices {
testImage(dir, "m1", "m2", "m3");
}
@Test
public void testVerboseAndNoBindServices() throws Throwable {
if (!hasJmods()) return;
Path dir = Paths.get("verboseNoBind");
List<String> output =
JLink.run("--output", dir.toString(),
"--module-path", MODULE_PATH,
"--verbose",
"--add-modules", "m1").output();
assertTrue(output.contains("m1 provides p1.S used by m1"));
testImage(dir, "m1");
}
/*
* Tests the given ${java.home} to only contain the specified modules
*/

View File

@ -247,6 +247,42 @@ public class SuggestProviders {
}
@Test
public void suggestTypeNotRealProvider() throws Throwable {
if (!hasJmods()) return;
List<String> output =
JLink.run("--module-path", MODULE_PATH,
"--add-modules", "m1",
"--suggest-providers",
"java.util.List").output();
System.out.println(output);
List<String> expected = List.of(
"No provider found for service specified to --suggest-providers: java.util.List"
);
assertTrue(output.containsAll(expected));
}
@Test
public void addNonObservableModule() throws Throwable {
if (!hasJmods()) return;
List<String> output =
JLink.run("--module-path", MODULE_PATH,
"--add-modules", "nonExistentModule",
"--suggest-providers",
"java.nio.charset.spi.CharsetProvider").output();
System.out.println(output);
List<String> expected = List.of(
"jdk.charsets provides java.nio.charset.spi.CharsetProvider used by java.base"
);
assertTrue(output.containsAll(expected));
}
static class JLink {
static final ToolProvider JLINK_TOOL = ToolProvider.findFirst("jlink")
.orElseThrow(() ->