@Test
public void shouldBeAbleToReadPipedStdOutAfterConsoleClosed() throws Exception
{

    PipedApplicationConsole console = new PipedApplicationConsole(1024, false);
    try (JavaApplication application = LocalPlatform.get().launch(JavaApplication.class,
                                                                  ClassName.of(SimpleApp.class),
                                                                  Arguments.of("foo", "bar"),
                                                                  Console.of(console)))
    {
        application.waitFor();
    }
    BufferedReader reader = console.getOutputReader();
    assertThat(reader.readLine(), is("Out: foo"));
    assertThat(reader.readLine(), is("Out: bar"));
    assertThat(reader.readLine(), is("(terminated)"));
    assertThat(reader.readLine(), is(nullValue()));
}