< prev index next >

test/jdk/tools/launcher/modules/patch/basic/PatchTestWarningError.java

Print this page
*** 133,10 ***
--- 133,29 ---
                  .getExitValue();
  
          assertTrue(exitValue != 0);
      }
  
+     /**
+      * Test with --patch-module options patching the same module (not java.base).
+      *
+      */
+     public void testDuplicateModuleLogging() throws Exception {
+         int exitValue =
+             executeTestJava("--patch-module", "java.logging=" + PATCHES1_DIR.resolve("java.base"),
+                             "--patch-module", "java.logging=" + PATCHES2_DIR.resolve("java.base"),
+                             "--module-path", MODS_DIR.toString(),
+                             "-m", "test/jdk.test.Main")
+                 .outputTo(System.out)
+                 .errorTo(System.out)
+                 // error output by VM
+                 .shouldContain("Cannot specify a module more than once to --patch-module: java.logging")
+                 .getExitValue();
+ 
+         assertTrue(exitValue != 0);
+     }
+ 
      @DataProvider(name = "emptyItem")
      public Object[][] emptyItems() {
          String patch1 = PATCHES1_DIR.resolve("java.base").toString();
          String patch2 = PATCHES2_DIR.resolve("java.base").toString();
          String pathSep = File.pathSeparator;
< prev index next >