< prev index next >

test/runtime/modules/IgnoreModulePropertiesTest.java

Print this page




  55     }
  56 
  57     // For options of the form "option=value", check that an exception gets thrown for
  58     // the illegal value and then check that its corresponding property is handled
  59     // correctly.
  60     public static void testOption(String option, String value,
  61                                   String prop, String result) throws Exception {
  62         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
  63             option + "=" + value, "-version");
  64         OutputAnalyzer output = new OutputAnalyzer(pb.start());
  65         output.shouldContain(result);
  66         testProperty(prop, value);
  67     }
  68 
  69     public static void main(String[] args) throws Exception {
  70         testOption("--add-modules", "java.sqlx", "jdk.module.addmods.0", "java.lang.module.ResolutionException");
  71         testOption("--limit-modules", "java.sqlx", "jdk.module.limitmods", "java.lang.module.ResolutionException");
  72         testOption("--add-reads", "xyzz=yyzd", "jdk.module.addreads.0", "WARNING: Unknown module: xyzz");
  73         testOption("--add-exports", "java.base/xyzz=yyzd", "jdk.module.addexports.0",
  74                    "WARNING: package xyzz not in java.base");
  75         testOption("--patch-module", "=d", "jdk.module.patch.0", "Missing module name");
  76     }
  77 }


  55     }
  56 
  57     // For options of the form "option=value", check that an exception gets thrown for
  58     // the illegal value and then check that its corresponding property is handled
  59     // correctly.
  60     public static void testOption(String option, String value,
  61                                   String prop, String result) throws Exception {
  62         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
  63             option + "=" + value, "-version");
  64         OutputAnalyzer output = new OutputAnalyzer(pb.start());
  65         output.shouldContain(result);
  66         testProperty(prop, value);
  67     }
  68 
  69     public static void main(String[] args) throws Exception {
  70         testOption("--add-modules", "java.sqlx", "jdk.module.addmods.0", "java.lang.module.ResolutionException");
  71         testOption("--limit-modules", "java.sqlx", "jdk.module.limitmods", "java.lang.module.ResolutionException");
  72         testOption("--add-reads", "xyzz=yyzd", "jdk.module.addreads.0", "WARNING: Unknown module: xyzz");
  73         testOption("--add-exports", "java.base/xyzz=yyzd", "jdk.module.addexports.0",
  74                    "WARNING: package xyzz not in java.base");
  75         testOption("--patch-module", "=d", "jdk.module.patch.0", "Unable to parse --patch-module");
  76     }
  77 }
< prev index next >