8071566: Improve testing for multi-version JAR file maker tool

Reviewed-by: chegar
This commit is contained in:
Andrey Nazarov 2017-01-18 20:36:15 +03:00
parent 6862616001
commit dd3c209701

View File

@ -182,6 +182,23 @@ public final class OutputAnalyzer {
return this;
}
/**
* 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
*
@ -365,6 +382,21 @@ public final class OutputAnalyzer {
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