jdk/test/sun/tools/jps/JpsHelper.java
changeset 28098 fbc3debb3d50
parent 27189 b90845965ee9
child 28103 7e1de7f8a5b9
--- a/jdk/test/sun/tools/jps/JpsHelper.java	Fri Nov 28 16:56:45 2014 +0100
+++ b/jdk/test/sun/tools/jps/JpsHelper.java	Mon Dec 01 09:49:44 2014 +0100
@@ -168,10 +168,8 @@
     }
 
     /**
-     * Verify jps output contains pids and programs' name information.
-     * The function will discard any lines that come before the first line with pid.
-     * This can happen if the JVM outputs a warning message for some reason
-     * before running jps.
+     * Verify jps stdout contains only pids and programs' name information.
+     * jps stderr may contain VM warning messages which will be ignored.
      *
      * The output can look like:
      * 35536 Jps
@@ -180,8 +178,10 @@
      */
     public static void verifyJpsOutput(OutputAnalyzer output, String regex) throws Exception {
         output.shouldHaveExitValue(0);
-        int matchedCount = output.shouldMatchByLineFrom(regex, regex);
+        int matchedCount = output.stdoutShouldMatchByLine(regex);
         assertGreaterThan(matchedCount , 0, "Found no lines matching pattern: " + regex);
+        output.stderrShouldNotMatch("[E|e]xception");
+        output.stderrShouldNotMatch("[E|e]rror");
     }
 
     /**