void (String outputStr, String expected, boolean splitByLines) { final List<String> lines; if (splitByLines) { lines = StringUtil.split(outputStr, "\n", false); } else { lines = Collections.singletonList(outputStr); } for (String line : lines) { myOutputConsumer.process(line, ProcessOutputTypes.STDOUT); } myOutputConsumer.flushBufferOnProcessTermination(0); assertEquals(expected, myEnventsProcessor.getOutput()); }