# HG changeset patch # User anazarov # Date 1484760975 -10800 # Node ID 8c1bd20e4f4510ef99040f85ba08febb5ba2074c # Parent 61b58ba861882b7e7dac819b2f3a47d953f7ddd1 8071566: Improve testing for multi-version JAR file maker tool Reviewed-by: chegar diff -r 61b58ba86188 -r 8c1bd20e4f45 test/lib/jdk/test/lib/process/OutputAnalyzer.java --- a/test/lib/jdk/test/lib/process/OutputAnalyzer.java Wed Jan 18 09:35:03 2017 +0000 +++ b/test/lib/jdk/test/lib/process/OutputAnalyzer.java Wed Jan 18 20:36:15 2017 +0300 @@ -183,6 +183,23 @@ } /** + * Verify that the stdout and stderr contents of output buffer does not contain the string + * + * @throws RuntimeException If the string was found + */ + public OutputAnalyzer shouldBeEmpty() { + if (!stdout.isEmpty()) { + reportDiagnosticSummary(); + throw new RuntimeException("stdout was not empty"); + } + if (!stderr.isEmpty()) { + reportDiagnosticSummary(); + throw new RuntimeException("stderr was not empty"); + } + return this; + } + + /** * Verify that the stdout contents of output buffer does not contain the string * * @param expectedString String that the buffer should not contain @@ -365,6 +382,21 @@ return this; } + /** + * Verify the exit value of the process + * + * @param notExpectedExitValue Unexpected exit value from process + * @throws RuntimeException If the exit value from the process did match the expected value + */ + public OutputAnalyzer shouldNotHaveExitValue(int notExpectedExitValue) { + if (getExitValue() == notExpectedExitValue) { + reportDiagnosticSummary(); + throw new RuntimeException("Unexpected to get exit value of [" + + notExpectedExitValue + "]\n"); + } + return this; + } + /** * Report summary that will help to diagnose the problem