changeset 2470:5fb86d73e54d

8071566: Improve testing for multi-version JAR file maker tool Reviewed-by: chegar
author anazarov
date Wed, 18 Jan 2017 20:36:15 +0300
parents ec276ecde338
children 15d2dce47c04
files test/lib/jdk/test/lib/process/OutputAnalyzer.java
diffstat 1 files changed, 32 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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