< prev index next >

jdk/test/jdk/modules/scenarios/overlappingpackages/OverlappingPackagesTest.java

Print this page




  57     /**
  58      * Compiles all modules used by the test
  59      */
  60     @BeforeTest
  61     public void compileAll() throws Exception {
  62         for (String mn : modules) {
  63             Path src = SRC_DIR.resolve(mn);
  64             Path mods = MODS_DIR.resolve(mn);
  65             assertTrue(CompilerUtils.compile(src, mods));
  66         }
  67         Path srcMisc = SRC_DIR.resolve("misc");
  68         Path modsMisc = MODS_DIR.resolve("misc");
  69         assertTrue(CompilerUtils.compile(srcMisc, modsMisc));
  70     }
  71 
  72     /**
  73      * Sanity check that the test runs without error.
  74      */
  75     public void testNoOverlappingPackages() throws Exception {
  76         int exitValue
  77             = executeTestJava("-mp", MODS_DIR.toString(),
  78                               "-m", "test/test.Main")
  79                 .outputTo(System.out)
  80                 .errorTo(System.err)
  81                 .getExitValue();
  82 
  83         assertTrue(exitValue == 0);
  84     }
  85 
  86 
  87     /**
  88      * Run the test with "-addmods misc", the misc module has package
  89      * jdk.internal.misc and so should overlap with the base module.
  90      */
  91     public void testOverlapWithBaseModule() throws Exception {
  92         int exitValue
  93             = executeTestJava("-mp", MODS_DIR.toString(),
  94                               "-addmods", "misc",
  95                               "-m", "test/test.Main")
  96                 .outputTo(System.out)
  97                 .errorTo(System.err)
  98                 .getExitValue();
  99 
 100         assertTrue(exitValue != 0);
 101     }
 102 
 103     /**
 104      * Run the test with "-addmods m1,m2". Both modules have package p.
 105      */
 106     public void testOverlap() throws Exception {
 107         int exitValue
 108             = executeTestJava("-mp", MODS_DIR.toString(),
 109                               "-addmods", "m1,m2",
 110                               "-m", "test/test.Main")
 111                 .outputTo(System.out)
 112                 .errorTo(System.err)
 113                 .getExitValue();
 114 
 115         assertTrue(exitValue != 0);
 116     }
 117 
 118 
 119 }


  57     /**
  58      * Compiles all modules used by the test
  59      */
  60     @BeforeTest
  61     public void compileAll() throws Exception {
  62         for (String mn : modules) {
  63             Path src = SRC_DIR.resolve(mn);
  64             Path mods = MODS_DIR.resolve(mn);
  65             assertTrue(CompilerUtils.compile(src, mods));
  66         }
  67         Path srcMisc = SRC_DIR.resolve("misc");
  68         Path modsMisc = MODS_DIR.resolve("misc");
  69         assertTrue(CompilerUtils.compile(srcMisc, modsMisc));
  70     }
  71 
  72     /**
  73      * Sanity check that the test runs without error.
  74      */
  75     public void testNoOverlappingPackages() throws Exception {
  76         int exitValue
  77             = executeTestJava("--module-path", MODS_DIR.toString(),
  78                               "-m", "test/test.Main")
  79                 .outputTo(System.out)
  80                 .errorTo(System.err)
  81                 .getExitValue();
  82 
  83         assertTrue(exitValue == 0);
  84     }
  85 
  86 
  87     /**
  88      * Run the test with "--add-modules misc", the misc module has package
  89      * jdk.internal.misc and so should overlap with the base module.
  90      */
  91     public void testOverlapWithBaseModule() throws Exception {
  92         int exitValue
  93             = executeTestJava("--module-path", MODS_DIR.toString(),
  94                               "-add-modules", "misc",
  95                               "-m", "test/test.Main")
  96                 .outputTo(System.out)
  97                 .errorTo(System.err)
  98                 .getExitValue();
  99 
 100         assertTrue(exitValue != 0);
 101     }
 102 
 103     /**
 104      * Run the test with "--add-modules m1,m2". Both modules have package p.
 105      */
 106     public void testOverlap() throws Exception {
 107         int exitValue
 108             = executeTestJava("--module-path", MODS_DIR.toString(),
 109                               "--add-modules", "m1,m2",
 110                               "-m", "test/test.Main")
 111                 .outputTo(System.out)
 112                 .errorTo(System.err)
 113                 .getExitValue();
 114 
 115         assertTrue(exitValue != 0);
 116     }
 117 
 118 
 119 }
< prev index next >