void () { mySynchronizer = new MockProcessStreamsSynchronizer(getTestRootDisposable()); mySynchronizer.doWhenStreamsSynchronized("java HelloWorld\n", ProcessOutputType.SYSTEM, 10); mySynchronizer.doWhenStreamsSynchronized("info:", ProcessOutputType.STDOUT, 10); mySynchronizer.doWhenStreamsSynchronized("warn:", ProcessOutputType.STDERR, 14); mySynchronizer.doWhenStreamsSynchronized("Error\n", ProcessOutputType.STDERR, 14); mySynchronizer.doWhenStreamsSynchronized("Hello from stdout", ProcessOutputType.STDOUT, 15); mySynchronizer.doWhenStreamsSynchronized("\n", ProcessOutputType.STDOUT, 16); assertFlushedChunks(new FlushedChunk("java HelloWorld\n", ProcessOutputType.SYSTEM, 10), new FlushedChunk("info:", ProcessOutputType.STDOUT, 10), new FlushedChunk("Hello from stdout", ProcessOutputType.STDOUT, 15), new FlushedChunk("\n", ProcessOutputType.STDOUT, 16)); mySynchronizer.advanceTimeTo(10 + AWAIT_SAME_STREAM_TEXT_MILLIS); assertFlushedChunks(new FlushedChunk("warn:", ProcessOutputType.STDERR, 10 + AWAIT_SAME_STREAM_TEXT_MILLIS), new FlushedChunk("Error\n", ProcessOutputType.STDERR, 10 + AWAIT_SAME_STREAM_TEXT_MILLIS)); mySynchronizer.doWhenStreamsSynchronized("info:", ProcessOutputType.STDOUT, 21); mySynchronizer.doWhenStreamsSynchronized("2\n", ProcessOutputType.STDOUT, 21); mySynchronizer.doWhenStreamsSynchronized("Another error", ProcessOutputType.STDERR, 22); assertFlushedChunks(new FlushedChunk("Another error", ProcessOutputType.STDERR, 22)); mySynchronizer.doWhenStreamsSynchronized("\n", ProcessOutputType.STDERR, 22); assertFlushedChunks(new FlushedChunk("\n", ProcessOutputType.STDERR, 22)); mySynchronizer.doWhenStreamsSynchronized("Process exited", ProcessOutputType.SYSTEM, 22); mySynchronizer.advanceTimeTo(14 + AWAIT_SAME_STREAM_TEXT_MILLIS); assertFlushedChunks(new FlushedChunk("info:", ProcessOutputType.STDOUT, 14 + AWAIT_SAME_STREAM_TEXT_MILLIS), new FlushedChunk("2\n", ProcessOutputType.STDOUT, 14 + AWAIT_SAME_STREAM_TEXT_MILLIS), new FlushedChunk("Process exited", ProcessOutputType.SYSTEM, 14 + AWAIT_SAME_STREAM_TEXT_MILLIS)); assertNoPendingChunks(); }