jdk/test/tools/launcher/modules/addmods/AddModsTest.java
changeset 41114 f83e9aebbab4
parent 40261 86a49ba76f52
child 43539 b7c4265f40e7
equal deleted inserted replaced
41113:8ba3d8daf78d 41114:f83e9aebbab4
    29  * @build AddModsTest CompilerUtils jdk.testlibrary.*
    29  * @build AddModsTest CompilerUtils jdk.testlibrary.*
    30  * @run testng AddModsTest
    30  * @run testng AddModsTest
    31  * @summary Basic test for java --add-modules
    31  * @summary Basic test for java --add-modules
    32  */
    32  */
    33 
    33 
       
    34 import java.io.File;
    34 import java.nio.file.Path;
    35 import java.nio.file.Path;
    35 import java.nio.file.Paths;
    36 import java.nio.file.Paths;
    36 
    37 
    37 import static jdk.testlibrary.ProcessTools.*;
    38 import static jdk.testlibrary.ProcessTools.*;
    38 
    39 
   222         assertTrue(exitValue == 0);
   223         assertTrue(exitValue == 0);
   223     }
   224     }
   224 
   225 
   225 
   226 
   226     /**
   227     /**
       
   228      * Tests {@code --add-modules} be specified more than once.
       
   229      */
       
   230     public void testWithMultipleAddModules() throws Exception {
       
   231 
       
   232         String modulepath = MODS1_DIR.toString() + File.pathSeparator +
       
   233                                 MODS2_DIR.toString();
       
   234         int exitValue
       
   235             = executeTestJava("--module-path", modulepath,
       
   236             "--add-modules", LOGGER_MODULE,
       
   237             "--add-modules", TEST_MODULE,
       
   238             "-m", TEST_MID,
       
   239             "logger.Logger")
       
   240             .outputTo(System.out)
       
   241             .errorTo(System.out)
       
   242             .getExitValue();
       
   243 
       
   244         assertTrue(exitValue == 0);
       
   245     }
       
   246 
       
   247 
       
   248     /**
   227      * Attempt to run with a bad module name specified to --add-modules
   249      * Attempt to run with a bad module name specified to --add-modules
   228      */
   250      */
   229     public void testRunWithBadAddMods() throws Exception {
   251     public void testRunWithBadAddMods() throws Exception {
   230 
   252 
   231         // java --module-path mods --add-modules DoesNotExist -m test ...
   253         // java --module-path mods --add-modules DoesNotExist -m test ...