Use a timeout != 0 in InvocableHandlerMethodTests

This commit is contained in:
Sebastien Deleuze
2019-06-05 11:52:08 +02:00
parent 2a19b8f7a5
commit 23e617160f

View File

@@ -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<HandlerMethodArgumentResolver> 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