test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java
branchJDK-8200758-branch
changeset 58464 d82489644b15
parent 58416 f09bf58c1f17
child 58648 3bf53ffa9ae7
equal deleted inserted replaced
58463:4e71249f291c 58464:d82489644b15
    68                     "Unexpeced nested or concurrent Test.run() call");
    68                     "Unexpeced nested or concurrent Test.run() call");
    69         }
    69         }
    70 
    70 
    71         TestInstance test = new TestInstance(testBody);
    71         TestInstance test = new TestInstance(testBody);
    72         ThrowingRunnable.toRunnable(() -> runTests(List.of(test))).run();
    72         ThrowingRunnable.toRunnable(() -> runTests(List.of(test))).run();
       
    73         test.rethrowIfSkipped();
    73         if (!test.passed()) {
    74         if (!test.passed()) {
    74             throw new RuntimeException();
    75             throw new RuntimeException();
    75         }
    76         }
    76     }
    77     }
    77 
    78 
   362         if (isWindows() || isLinux() || isOSX()) {
   363         if (isWindows() || isLinux() || isOSX()) {
   363             throw new IllegalStateException(
   364             throw new IllegalStateException(
   364                     "Platform is known. throwUnknownPlatformError() called by mistake");
   365                     "Platform is known. throwUnknownPlatformError() called by mistake");
   365         }
   366         }
   366         throw new IllegalStateException("Unknown platform");
   367         throw new IllegalStateException("Unknown platform");
       
   368     }
       
   369 
       
   370     public static RuntimeException throwSkippedException(String reason) {
       
   371         trace("Skip the test: " + reason);
       
   372         RuntimeException ex = ThrowingSupplier.toSupplier(
       
   373                 () -> (RuntimeException) Class.forName("jtreg.SkippedException").getConstructor(
       
   374                         String.class).newInstance(reason)).get();
       
   375 
       
   376         currentTest.notifySkipped(ex);
       
   377         throw ex;
   367     }
   378     }
   368 
   379 
   369     static void waitForFileCreated(Path fileToWaitFor,
   380     static void waitForFileCreated(Path fileToWaitFor,
   370             long timeoutSeconds) throws IOException {
   381             long timeoutSeconds) throws IOException {
   371 
   382