diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/InvocableHandlerMethodTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/InvocableHandlerMethodTests.java index 4feff4680de..cbef4c21c00 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/InvocableHandlerMethodTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/InvocableHandlerMethodTests.java @@ -58,6 +58,9 @@ import static org.springframework.mock.http.server.reactive.test.MockServerHttpR */ public class InvocableHandlerMethodTests { + private static final Duration TIMEOUT = Duration.ofSeconds(5); + + private final MockServerWebExchange exchange = MockServerWebExchange.from(get("http://localhost:8080/path")); private final List resolvers = new ArrayList<>(); @@ -177,7 +180,7 @@ public class InvocableHandlerMethodTests { HandlerResult result = invokeForResult(new TestController(), method); assertThat(result).as("Expected no result (i.e. fully handled)").isNull(); - assertThat(this.exchange.getResponse().getBodyAsString().block(Duration.ZERO)).isEqualTo("body"); + assertThat(this.exchange.getResponse().getBodyAsString().block(TIMEOUT)).isEqualTo("body"); } @Test @@ -197,7 +200,7 @@ public class InvocableHandlerMethodTests { HandlerResult result = invokeForResult(new TestController(), method); assertThat(result).as("Expected no result (i.e. fully handled)").isNull(); - assertThat(this.exchange.getResponse().getBodyAsString().block(Duration.ZERO)).isEqualTo("body"); + assertThat(this.exchange.getResponse().getBodyAsString().block(TIMEOUT)).isEqualTo("body"); } @Test