< prev index next >

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

Print this page




  45             throw new AssertionError("Invalid number of lines in output: "
  46                     + result.length);
  47         }
  48 
  49         if (arg.equals(ARG1)) {
  50             if (!result[0].trim().contains(RESULT1)) {
  51                 System.err.println("Expected: " + RESULT1);
  52                 System.err.println("Actual: " + result[0]);
  53                 throw new AssertionError("Unexpected output: " + result[0]);
  54             }
  55         } else if (arg.equals(ARG2)) {
  56             if (!result[0].trim().contains(RESULT2)) {
  57                 System.err.println("Expected: " + RESULT2);
  58                 System.err.println("Actual: " + result[0]);
  59                 throw new AssertionError("Unexpected output: " + result[0]);
  60             }
  61         }
  62     }
  63 
  64     private static void testInvalidArg() throws Exception {
  65         String output = JPackageHelper.executeCLI(false, ARG1);

  66         validate(ARG1, output);
  67         output = JPackageHelper.executeCLI(false, ARG2);


  68         validate(ARG2, output);
  69     }
  70 
  71     private static void testInvalidArgToolProvider() throws Exception {
  72         String output = JPackageHelper.executeToolProvider(false, ARG1);

  73         validate(ARG1, output);
  74         output = JPackageHelper.executeToolProvider(false, ARG2);


  75         validate(ARG2, output);
  76     }
  77 
  78     public static void main(String[] args) throws Exception {
  79         testInvalidArg();
  80         testInvalidArgToolProvider();
  81     }
  82 
  83 }


  45             throw new AssertionError("Invalid number of lines in output: "
  46                     + result.length);
  47         }
  48 
  49         if (arg.equals(ARG1)) {
  50             if (!result[0].trim().contains(RESULT1)) {
  51                 System.err.println("Expected: " + RESULT1);
  52                 System.err.println("Actual: " + result[0]);
  53                 throw new AssertionError("Unexpected output: " + result[0]);
  54             }
  55         } else if (arg.equals(ARG2)) {
  56             if (!result[0].trim().contains(RESULT2)) {
  57                 System.err.println("Expected: " + RESULT2);
  58                 System.err.println("Actual: " + result[0]);
  59                 throw new AssertionError("Unexpected output: " + result[0]);
  60             }
  61         }
  62     }
  63 
  64     private static void testInvalidArg() throws Exception {
  65         String output = JPackageHelper.executeCLI(false,
  66                 "--package-type", "app-image", ARG1);
  67         validate(ARG1, output);
  68 
  69         output = JPackageHelper.executeCLI(false,
  70                 "--package-type", "app-image", ARG2);
  71         validate(ARG2, output);
  72     }
  73 
  74     private static void testInvalidArgToolProvider() throws Exception {
  75         String output = JPackageHelper.executeToolProvider(false,
  76                 "--package-type", "app-image", ARG1);
  77         validate(ARG1, output);
  78 
  79         output = JPackageHelper.executeToolProvider(false,
  80                 "--package-type", "app-image", ARG2);
  81         validate(ARG2, output);
  82     }
  83 
  84     public static void main(String[] args) throws Exception {
  85         testInvalidArg();
  86         testInvalidArgToolProvider();
  87     }
  88 
  89 }
< prev index next >