< prev index next >
test/jdk/sun/tools/jstatd/TestJstatdUsage.java
Print this page
rev 48243 : 8189102: All tools should support -?, -h and --help
Reviewed-by: kvn, jjg, weijun, alanb, rfield, ksrini
*** 1,7 ****
/*
! * Copyright (c) 2013, 2015, 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.
--- 1,7 ----
/*
! * Copyright (c) 2013, 2017, 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.
*** 34,53 ****
* @run main TestJstatdUsage
*/
public class TestJstatdUsage {
public static void main(String[] args) throws Exception {
- testUsage("-help");
testUsage("-?");
}
private static void testUsage(String option) throws Exception {
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstatd");
launcher.addToolArg(option);
ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
output.shouldContain("usage: jstatd [-nr] [-p port] [-n rminame]");
! output.shouldHaveExitValue(1);
}
}
--- 34,54 ----
* @run main TestJstatdUsage
*/
public class TestJstatdUsage {
public static void main(String[] args) throws Exception {
testUsage("-?");
+ testUsage("-h");
+ testUsage("--help");
}
private static void testUsage(String option) throws Exception {
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstatd");
launcher.addToolArg(option);
ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
output.shouldContain("usage: jstatd [-nr] [-p port] [-n rminame]");
! output.shouldHaveExitValue(0);
}
}
< prev index next >