@Test(timeout = 60_000L)
    public void testToStringConsumer() throws TimeoutException {
        WaitingConsumer waitingConsumer = new WaitingConsumer();
        ToStringConsumer toStringConsumer = new ToStringConsumer();

        Consumer<OutputFrame> composedConsumer = toStringConsumer.andThen(waitingConsumer);
        container.followOutput(composedConsumer);

        waitingConsumer.waitUntilEnd(30, TimeUnit.SECONDS);

        String utf8String = toStringConsumer.toUtf8String();
        assertThat(utf8String).as("the expected first value was found").contains("seq=1");
        assertThat(utf8String).as("the expected last value was found").contains("seq=4");
        assertThat(utf8String).as("a non-expected value was found").doesNotContain("seq=42");
    }
Simple test for following container output.
core/src/test/java/org/testcontainers/junit/OutputStreamTest.java