< prev index next >

test/tools/jlink/bindservices/SuggestProviders.java

Print this page

        

*** 169,178 **** --- 169,214 ---- String expected = "--bind-services option is specified. No additional providers suggested."; assertTrue(output.contains(expected)); } + @Test + public void suggestNotProvider() 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( + "Services specified in --suggest-providers not used: java.util.List" + ); + + assertTrue(output.containsAll(expected)); + } + + @Test + public void noOneUsesProvider() throws Throwable { + if (!hasJmods()) return; + + List<String> output = + JLink.run("--module-path", MODULE_PATH, + "--add-modules", "m4", + "--suggest-providers", + "p4.Impl").output(); + + System.out.println(output); + List<String> expected = List.of( + "Services specified in --suggest-providers not used: p4.Impl" + ); + + assertTrue(output.containsAll(expected)); + } + static class JLink { static final ToolProvider JLINK_TOOL = ToolProvider.findFirst("jlink") .orElseThrow(() -> new RuntimeException("jlink tool not found") );
< prev index next >