< prev index next >

test/jdk/java/lang/invoke/findSpecial/FindSpecialTest.java

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

@@ -35,17 +35,15 @@
  import java.io.File;
  import java.nio.file.Files;
  import java.nio.file.Path;
  import java.nio.file.Paths;
  
- import jdk.test.lib.JDKToolFinder;
- import jdk.test.lib.process.ProcessTools;
+ import static jdk.test.lib.process.ProcessTools.*;
  
  import org.testng.annotations.Test;
  
  public class FindSpecialTest {
-     static final String JAVA_LAUNCHER = JDKToolFinder.getJDKTool("java");
      static final String TEST_CLASSES = System.getProperty("test.classes", ".");
      static final String TEST_CLASS_PATH = System.getProperty("test.class.path");
      static final String TEST_MAIN_CLASS = "test.FindSpecial";
      static final String TEST_MODULE = "m1";
  

@@ -57,12 +55,13 @@
          Path m1 = Paths.get(TEST_CLASSES, "modules", TEST_MODULE);
          if (Files.notExists(m1)) {
              throw new Error(m1 + " not exist");
          }
          String classpath = m1.toString() + File.pathSeparator + TEST_CLASS_PATH;
-         ProcessTools.executeCommand(JAVA_LAUNCHER, "-cp", classpath, TEST_MAIN_CLASS)
-                     .shouldHaveExitValue(0);
+         executeCommand(createTestJavaProcessBuilder("-cp", classpath,
+                                                     TEST_MAIN_CLASS))
+                 .shouldHaveExitValue(0);
      }
  
      /*
       * Run test.FindSpecial in a named module
       */

@@ -70,12 +69,11 @@
      public static void callerInNamedModule() throws Throwable {
          Path modules = Paths.get(TEST_CLASSES, "modules");
          if (Files.notExists(modules)) {
              throw new Error(modules + " not exist");
          }
-         ProcessTools.executeCommand(JAVA_LAUNCHER,
-                                     "-cp", TEST_CLASS_PATH,
-                                     "-p", modules.toString(),
-                                     "-m", TEST_MODULE + "/" + TEST_MAIN_CLASS)
-                     .shouldHaveExitValue(0);
+         executeCommand(createTestJavaProcessBuilder("-cp", TEST_CLASS_PATH,
+                                                     "-p", modules.toString(),
+                                                     "-m", TEST_MODULE + "/" + TEST_MAIN_CLASS))
+                 .shouldHaveExitValue(0);
      }
  }
< prev index next >