@Test(timeout = 60_000L)
    public void testFetchStdoutWithTimeout() {
        WaitingConsumer consumer = new WaitingConsumer();

        container.followOutput(consumer, OutputFrame.OutputType.STDOUT);

        assertThat(
            catchThrowable(() -> {
                consumer.waitUntil(
                    frame -> {
                        return (
                            frame.getType() == OutputFrame.OutputType.STDOUT && frame.getUtf8String().contains("seq=5")
                        );
                    },
                    2,
                    TimeUnit.SECONDS
                );
            })
        )
            .as("a TimeoutException should be thrown")
            .isInstanceOf(TimeoutException.class);
    }
Simple test for following container output.
core/src/test/java/org/testcontainers/junit/OutputStreamTest.java