< prev index next >

test/langtools/tools/jdeps/listdeps/ListModuleDeps.java

Print this page




  77 
  78         // simple program depends only on java.base
  79         assertTrue(CompilerUtils.compile(Paths.get(TEST_SRC, "src", "hi"), CLASSES_DIR));
  80 
  81         // compile classes in unnamed module
  82         assertTrue(CompilerUtils.compile(Paths.get(TEST_SRC, "src", "z"),
  83             CLASSES_DIR,
  84             "-cp", LIB_DIR.toString(),
  85             "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED",
  86             "--add-exports=java.base/sun.security.util=ALL-UNNAMED",
  87             "--add-exports=java.xml/jdk.xml.internal=ALL-UNNAMED"
  88         ));
  89     }
  90 
  91     @DataProvider(name = "jdkModules")
  92     public Object[][] jdkModules() {
  93         return new Object[][]{
  94             {"jdk.compiler", new String[]{
  95                                 "java.base/jdk.internal.jmod",
  96                                 "java.base/jdk.internal.misc",

  97                                 "java.base/sun.reflect.annotation",
  98                                 "java.compiler",
  99                              }
 100             },
 101         };
 102     }
 103 
 104     @Test(dataProvider = "jdkModules")
 105     public void testJDKModule(String moduleName, String[] expected) {
 106         JdepsRunner jdeps = JdepsRunner.run(
 107             "--list-deps", "-m", moduleName
 108         );
 109         String[] output = Arrays.stream(jdeps.output())
 110                                 .map(s -> s.trim())
 111                                 .toArray(String[]::new);
 112         assertEquals(output, expected);
 113     }
 114 
 115     @Test(dataProvider = "listdeps")
 116     public void testListDeps(Path classes, String[] expected) {




  77 
  78         // simple program depends only on java.base
  79         assertTrue(CompilerUtils.compile(Paths.get(TEST_SRC, "src", "hi"), CLASSES_DIR));
  80 
  81         // compile classes in unnamed module
  82         assertTrue(CompilerUtils.compile(Paths.get(TEST_SRC, "src", "z"),
  83             CLASSES_DIR,
  84             "-cp", LIB_DIR.toString(),
  85             "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED",
  86             "--add-exports=java.base/sun.security.util=ALL-UNNAMED",
  87             "--add-exports=java.xml/jdk.xml.internal=ALL-UNNAMED"
  88         ));
  89     }
  90 
  91     @DataProvider(name = "jdkModules")
  92     public Object[][] jdkModules() {
  93         return new Object[][]{
  94             {"jdk.compiler", new String[]{
  95                                 "java.base/jdk.internal.jmod",
  96                                 "java.base/jdk.internal.misc",
  97                                 "java.base/sun.invoke.util",
  98                                 "java.base/sun.reflect.annotation",
  99                                 "java.compiler",
 100                              }
 101             },
 102         };
 103     }
 104 
 105     @Test(dataProvider = "jdkModules")
 106     public void testJDKModule(String moduleName, String[] expected) {
 107         JdepsRunner jdeps = JdepsRunner.run(
 108             "--list-deps", "-m", moduleName
 109         );
 110         String[] output = Arrays.stream(jdeps.output())
 111                                 .map(s -> s.trim())
 112                                 .toArray(String[]::new);
 113         assertEquals(output, expected);
 114     }
 115 
 116     @Test(dataProvider = "listdeps")
 117     public void testListDeps(Path classes, String[] expected) {


< prev index next >