8071566: Improve testing for multi-version JAR file maker tool
Reviewed-by: chegar
--- 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