< prev index next >

test/jdk/lib/testlibrary/OutputAnalyzerTest.java

Print this page
rev 51638 : [mq]: 8210112
rev 51639 : [mq]: 8210112-1

@@ -18,20 +18,21 @@
  *
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-package jdk.testlibrary;
 
 /*
  * @test
  * @summary Test the OutputAnalyzer utility class
  * @modules java.management
- * @build jdk.testlibrary.*
- * @run main jdk.testlibrary.OutputAnalyzerTest
+ * @library /test/lib
+ * @run main OutputAnalyzerTest
  */
 
+import jdk.test.lib.process.OutputAnalyzer;
+
 public class OutputAnalyzerTest {
 
     public static void main(String args[]) throws Exception {
 
         String stdout = "aaaaaa";

@@ -148,21 +149,27 @@
                     "stderrShouldMatch() failed to throw exception");
         } catch (RuntimeException e) {
             // expected
         }
 
-        if (output.shouldMatchByLine(byLinePattern) != 1) {
-            throw new Exception("shouldMatchByLine() should find one line");
+        try {
+            output.shouldMatchByLine(byLinePattern);
+        } catch (RuntimeException e) {
+            throw new Exception("shouldMatchByLine() failed", e);
         }
+
         try {
             output.shouldMatchByLine(nonExistingPattern);
             throw new Exception("shouldMatchByLine() failed to throw exception");
         } catch (RuntimeException e) {
             // expected
         }
-        if (output.stdoutShouldMatchByLine(stdoutByLinePattern) != 1) {
-            throw new Exception("stdoutShouldMatchByLine() should find one line");
+
+        try {
+            output.stdoutShouldMatchByLine(stdoutByLinePattern);
+        } catch (RuntimeException e) {
+            throw new Exception("stdoutShouldMatchByLine() failed", e);
         }
 
         // Should not match
         try {
             output.shouldNotMatch(nonExistingPattern);
< prev index next >