< prev index next >

jdk/test/java/lang/invoke/modules/ModuleAccessControlTest.java

Print this page




  43 
  44 public class ModuleAccessControlTest {
  45 
  46     private static final String TEST_SRC = System.getProperty("test.src");
  47 
  48     private static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
  49     private static final Path MODS_DIR = Paths.get("mods");
  50 
  51     // the names of the modules in this test
  52     private static List<String> modules = Arrays.asList("m1", "m2");
  53 
  54 
  55     /**
  56      * Compiles all modules used by the test
  57      */
  58     @BeforeTest
  59     public void compileAll() throws Exception {
  60         for (String mn : modules) {
  61             Path msrc = SRC_DIR.resolve(mn);
  62             assertTrue(CompilerUtils
  63                 .compile(msrc, MODS_DIR, "-modulesourcepath", SRC_DIR.toString()));
  64         }
  65     }
  66 
  67     /**
  68      * Launch the test
  69      */
  70     @Test
  71     public void runTest() throws Exception {
  72         int exitValue = executeTestJava("-mp", MODS_DIR.toString(),
  73                                         "-m", "m1/p1.Main")
  74                 .outputTo(System.out)
  75                 .errorTo(System.out)
  76                 .getExitValue();
  77 
  78         assertTrue(exitValue == 0);
  79     }
  80 
  81 }


  43 
  44 public class ModuleAccessControlTest {
  45 
  46     private static final String TEST_SRC = System.getProperty("test.src");
  47 
  48     private static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
  49     private static final Path MODS_DIR = Paths.get("mods");
  50 
  51     // the names of the modules in this test
  52     private static List<String> modules = Arrays.asList("m1", "m2");
  53 
  54 
  55     /**
  56      * Compiles all modules used by the test
  57      */
  58     @BeforeTest
  59     public void compileAll() throws Exception {
  60         for (String mn : modules) {
  61             Path msrc = SRC_DIR.resolve(mn);
  62             assertTrue(CompilerUtils
  63                 .compile(msrc, MODS_DIR, "--module-source-path", SRC_DIR.toString()));
  64         }
  65     }
  66 
  67     /**
  68      * Launch the test
  69      */
  70     @Test
  71     public void runTest() throws Exception {
  72         int exitValue = executeTestJava("--module-path", MODS_DIR.toString(),
  73                                         "-m", "m1/p1.Main")
  74                 .outputTo(System.out)
  75                 .errorTo(System.out)
  76                 .getExitValue();
  77 
  78         assertTrue(exitValue == 0);
  79     }
  80 
  81 }
< prev index next >