< prev index next >

test/jdk/java/lang/RuntimeTests/RuntimeExitLogTest.java

Print this page

 24 
 25 import java.io.BufferedReader;
 26 import java.io.IOException;
 27 import java.nio.file.Path;
 28 import java.util.List;
 29 import java.util.logging.LogRecord;
 30 import java.util.logging.Logger;
 31 import java.util.logging.StreamHandler;
 32 import java.util.stream.Stream;
 33 
 34 
 35 import org.junit.jupiter.params.provider.Arguments;
 36 import org.junit.jupiter.params.provider.MethodSource;
 37 import org.junit.jupiter.params.ParameterizedTest;
 38 import static org.junit.jupiter.api.Assertions.assertEquals;
 39 import static org.junit.jupiter.api.Assertions.fail;
 40 
 41 /*
 42  * @test
 43  * @summary verify logging of call to System.exit or Runtime.exit.

 44  * @run junit/othervm RuntimeExitLogTest
 45  */
 46 
 47 public class RuntimeExitLogTest {
 48 
 49     private static final String TEST_JDK = System.getProperty("test.jdk");
 50     private static final String TEST_SRC = System.getProperty("test.src");
 51 
 52     private static Object HOLD_LOGGER;
 53 
 54     /**
 55      * Call System.exit() with the parameter (or zero if not supplied).
 56      * @param args zero or 1 argument, an exit status
 57      */
 58     public static void main(String[] args) throws InterruptedException {
 59         int status = args.length > 0 ? Integer.parseInt(args[0]) : 0;
 60         if (System.getProperty("ThrowingHandler") != null) {
 61             HOLD_LOGGER = ThrowingHandler.installHandler();
 62         }
 63         System.exit(status);

 24 
 25 import java.io.BufferedReader;
 26 import java.io.IOException;
 27 import java.nio.file.Path;
 28 import java.util.List;
 29 import java.util.logging.LogRecord;
 30 import java.util.logging.Logger;
 31 import java.util.logging.StreamHandler;
 32 import java.util.stream.Stream;
 33 
 34 
 35 import org.junit.jupiter.params.provider.Arguments;
 36 import org.junit.jupiter.params.provider.MethodSource;
 37 import org.junit.jupiter.params.ParameterizedTest;
 38 import static org.junit.jupiter.api.Assertions.assertEquals;
 39 import static org.junit.jupiter.api.Assertions.fail;
 40 
 41 /*
 42  * @test
 43  * @summary verify logging of call to System.exit or Runtime.exit.
 44  * @requires vm.flagless
 45  * @run junit/othervm RuntimeExitLogTest
 46  */
 47 
 48 public class RuntimeExitLogTest {
 49 
 50     private static final String TEST_JDK = System.getProperty("test.jdk");
 51     private static final String TEST_SRC = System.getProperty("test.src");
 52 
 53     private static Object HOLD_LOGGER;
 54 
 55     /**
 56      * Call System.exit() with the parameter (or zero if not supplied).
 57      * @param args zero or 1 argument, an exit status
 58      */
 59     public static void main(String[] args) throws InterruptedException {
 60         int status = args.length > 0 ? Integer.parseInt(args[0]) : 0;
 61         if (System.getProperty("ThrowingHandler") != null) {
 62             HOLD_LOGGER = ThrowingHandler.installHandler();
 63         }
 64         System.exit(status);
< prev index next >