pom.xml:

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-test</artifactId>
  <scope>test</scope>
</dependency>


Usage

SomeJavaClassIntegrationTest.java:

@ExtendWith({ SpringExtension.class, OutputCaptureExtension.class })
// ...
public class SomeJavaClassIntegrationTest {

// ...

  @Test
  public void shouldConsumeMessage(CapturedOutput output) {
    // Given
    // ...

    // When
    // ...

    // Then
    MatcherAssert.assertThat(output.getOut(), Matchers.containsString("Blah String"));
    // Or
    Awaitility.await().atMost(2, TimeUnit.SECONDS).until(() ->
      output.getOut().contains("Blah String"));
  }
// ...
}