< prev index next >

test/jdk/tools/jpackage/share/InvalidArgTest.java

Print this page

        

*** 22,47 **** */ /* * @test * @summary jpackage invalid argument test ! * @library helpers * @build JPackageHelper * @build JPackagePath ! * @modules jdk.jpackage ! * @run main/othervm -Xmx512m JPackageInvalidArgTest */ ! public class JPackageInvalidArgTest { private static final String ARG1 = "--no-such-argument"; ! private static final String ARG2 = "--output"; private static final String RESULT1 = "Invalid Option: [--no-such-argument]"; ! private static final String RESULT2 = "Mode is not specified"; private static void validate(String arg, String output) throws Exception { ! String[] result = output.split("\n"); if (result.length != 1) { System.err.println(output); throw new AssertionError("Invalid number of lines in output: " + result.length); } --- 22,47 ---- */ /* * @test * @summary jpackage invalid argument test ! * @library ../helpers * @build JPackageHelper * @build JPackagePath ! * @modules jdk.incubator.jpackage ! * @run main/othervm -Xmx512m InvalidArgTest */ ! public class InvalidArgTest { private static final String ARG1 = "--no-such-argument"; ! private static final String ARG2 = "--dest"; private static final String RESULT1 = "Invalid Option: [--no-such-argument]"; ! private static final String RESULT2 = "--main-jar or --module"; private static void validate(String arg, String output) throws Exception { ! String[] result = JPackageHelper.splitAndFilter(output); if (result.length != 1) { System.err.println(output); throw new AssertionError("Invalid number of lines in output: " + result.length); }
*** 60,79 **** } } } private static void testInvalidArg() throws Exception { ! String output = JPackageHelper.executeCLI(false, ARG1); validate(ARG1, output); ! output = JPackageHelper.executeCLI(false, ARG2); validate(ARG2, output); } private static void testInvalidArgToolProvider() throws Exception { ! String output = JPackageHelper.executeToolProvider(false, ARG1); validate(ARG1, output); ! output = JPackageHelper.executeToolProvider(false, ARG2); validate(ARG2, output); } public static void main(String[] args) throws Exception { testInvalidArg(); --- 60,85 ---- } } } private static void testInvalidArg() throws Exception { ! String output = JPackageHelper.executeCLI(false, ! "--type", "app-image", ARG1); validate(ARG1, output); ! ! output = JPackageHelper.executeCLI(false, ! "--type", "app-image", ARG2); validate(ARG2, output); } private static void testInvalidArgToolProvider() throws Exception { ! String output = JPackageHelper.executeToolProvider(false, ! "--type", "app-image", ARG1); validate(ARG1, output); ! ! output = JPackageHelper.executeToolProvider(false, ! "--type", "app-image", ARG2); validate(ARG2, output); } public static void main(String[] args) throws Exception { testInvalidArg();
< prev index next >