< prev index next >

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

Print this page




  22  */
  23 
  24 import java.io.File;
  25 import java.nio.file.Files;
  26 
  27 /*
  28  * @test
  29  * @summary jpackage create image with no --name
  30  * @library ../helpers
  31  * @build JPackageHelper
  32  * @build JPackagePath
  33  * @modules jdk.jpackage
  34  * @run main/othervm -Xmx512m NoNameTest
  35  */
  36 public class NoNameTest {
  37     private static final String OUTPUT = "output";
  38     private static final String app = JPackagePath.getApp("Hello");
  39     private static final String appOutput = JPackagePath.getAppOutputFile();
  40 
  41     private static final String[] CMD = {

  42         "--input", "input",
  43         "--output", OUTPUT,
  44         "--main-jar", "hello.jar",
  45         "--main-class", "Hello",
  46     };
  47 
  48     private static void validateResult(String[] result) throws Exception {
  49         if (result.length != 2) {
  50             throw new AssertionError(
  51                    "Unexpected number of lines: " + result.length);
  52         }
  53 
  54         if (!result[0].trim().equals("jpackage test application")) {
  55             throw new AssertionError("Unexpected result[0]: " + result[0]);
  56         }
  57 
  58         if (!result[1].trim().equals("args.length: 0")) {
  59             throw new AssertionError("Unexpected result[1]: " + result[1]);
  60         }
  61     }




  22  */
  23 
  24 import java.io.File;
  25 import java.nio.file.Files;
  26 
  27 /*
  28  * @test
  29  * @summary jpackage create image with no --name
  30  * @library ../helpers
  31  * @build JPackageHelper
  32  * @build JPackagePath
  33  * @modules jdk.jpackage
  34  * @run main/othervm -Xmx512m NoNameTest
  35  */
  36 public class NoNameTest {
  37     private static final String OUTPUT = "output";
  38     private static final String app = JPackagePath.getApp("Hello");
  39     private static final String appOutput = JPackagePath.getAppOutputFile();
  40 
  41     private static final String[] CMD = {
  42         "--package-type", "app-image",
  43         "--input", "input",
  44         "--output", OUTPUT,
  45         "--main-jar", "hello.jar",
  46         "--main-class", "Hello",
  47     };
  48 
  49     private static void validateResult(String[] result) throws Exception {
  50         if (result.length != 2) {
  51             throw new AssertionError(
  52                    "Unexpected number of lines: " + result.length);
  53         }
  54 
  55         if (!result[0].trim().equals("jpackage test application")) {
  56             throw new AssertionError("Unexpected result[0]: " + result[0]);
  57         }
  58 
  59         if (!result[1].trim().equals("args.length: 0")) {
  60             throw new AssertionError("Unexpected result[1]: " + result[1]);
  61         }
  62     }


< prev index next >