void () { mySplitter = createEventSplitter(true, false); for (ProcessOutputType key : new ProcessOutputType[]{ProcessOutputType.STDOUT, ProcessOutputType.STDERR}) { mySplitter.process("a\nbc\n", key); mySplitter.process("a", key); mySplitter.process("bc", key); mySplitter.process("d\na", key); mySplitter.process("bc", key); mySplitter.flush(); Assert.assertEquals( "Must be flushed on new line only in " + key, Arrays.asList("a\n", "bc\n", "abcd\n", "abc"), myOutput.get(key).toList()); myOutput.clear(); } mySplitter.process("stdout_message", ProcessOutputTypes.STDOUT); mySplitter.process("very ", ProcessOutputTypes.STDERR); mySplitter.process("long ", ProcessOutputTypes.STDERR); mySplitter.process("\n", ProcessOutputTypes.STDOUT); mySplitter.process("line\n", ProcessOutputTypes.STDERR); Assert.assertEquals( "Stderr and stdout must be processed separately", Collections.singletonList("very long line\n"), myOutput.get(ProcessOutputTypes.STDERR).toList()); Assert.assertEquals( "Stderr and stdout must be processed separately", Collections.singletonList("stdout_message\n"), myOutput.get(ProcessOutputTypes.STDOUT).toList()); }