From 9bd5c1a3c27369f76dad1ebacb9eeef4481c530c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Tue, 14 Oct 2025 11:33:03 +0200 Subject: [PATCH] Polish "Bind WebTestClient to the default WebHandler" See gh-47617 --- .../WebTestClientAutoConfigurationTests.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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