diff --git a/module/spring-boot-webtestclient/src/test/java/org/springframework/boot/webflux/test/autoconfigure/WebTestClientAutoConfigurationTests.java b/module/spring-boot-webtestclient/src/test/java/org/springframework/boot/webflux/test/autoconfigure/WebTestClientAutoConfigurationTests.java index 42cfc0caf42..977894157ee 100644 --- a/module/spring-boot-webtestclient/src/test/java/org/springframework/boot/webflux/test/autoconfigure/WebTestClientAutoConfigurationTests.java +++ b/module/spring-boot-webtestclient/src/test/java/org/springframework/boot/webflux/test/autoconfigure/WebTestClientAutoConfigurationTests.java @@ -87,11 +87,14 @@ class WebTestClientAutoConfigurationTests { void shouldFailWithNeitherDefaultWebHandlerNorWebApplicationContext() { ClassLoader parentClassLoader = Thread.currentThread().getContextClassLoader(); this.contextRunner.withClassLoader(new FilteredClassLoader(parentClassLoader, WebApplicationContext.class)) - .run((context) -> assertThat(context).getFailure() - .rootCause() - .isInstanceOf(RuntimeException.class) - .hasMessageStartingWith("Mock WebTestClient support requires") - .hasMessageContaining("WebApplicationContext")); + .run((context) -> { + assertThat(context).hasFailed(); + assertThat(context).getFailure() + .rootCause() + .isInstanceOf(RuntimeException.class) + .hasMessageStartingWith("Mock WebTestClient support requires") + .hasMessageContaining("WebApplicationContext"); + }); } @Test