SystemUtil { static StringBuilder printProcessErrorsOutput(Process p) throws IOException { StringBuilder builder = new StringBuilder(); BufferedReader bre = new BufferedReader(new InputStreamReader(p.getErrorStream())); String line; while ((line = bre.readLine()) != null) { System.out.println(line); builder.append(line); } bre.close(); return builder; }  @Deprecated static long getSystemTimeMillis(); static long getTimeBasedSeed(); static int getTimeBasedIntSeed(); static long getRelativeTimeMillis(); static long getFreeMemory(); static String getPropertyOrEnvironmentVariable(String name); static boolean runProcessAndWait(String exec, String params); static boolean runProcessAndWait(String exec, String params, String workingDirPath); static int runProcessAndGetExitCode(String exec, String params); static int runProcessAndGetExitCode(String exec, String params, String workingDirPath); static String runProcessAndGetOutput(String command, String params); static StringBuilder runProcessAndCollectErrors(String execPath, String params);  }
@Test public void printProcessErrorsOutputTest() throws IOException { StringBuilder stringBuilder = SystemUtil.printProcessErrorsOutput(new TestProcess()); Assert.assertEquals("This is error info", stringBuilder.toString()); }