From 75aebfaf27f93e669f84808ce0697cce400d7c07 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Tue, 18 Jul 2017 15:00:13 -0700 Subject: [PATCH] Fix WebClientAutoConfigurationTests Update tests to return a mock response rather than Mono.empty(). --- .../function/client/WebClientAutoConfigurationTests.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/function/client/WebClientAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/function/client/WebClientAutoConfigurationTests.java index 580fcbfce8..7e8df62961 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/function/client/WebClientAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/function/client/WebClientAutoConfigurationTests.java @@ -29,6 +29,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpMethod; import org.springframework.http.client.reactive.ClientHttpConnector; +import org.springframework.http.client.reactive.ClientHttpResponse; import org.springframework.http.codec.CodecConfigurer; import org.springframework.web.reactive.function.client.WebClient; @@ -80,12 +81,15 @@ public class WebClientAutoConfigurationTests { @Test public void shouldGetPrototypeScopedBean() throws Exception { load(WebClientCustomizerConfig.class); + ClientHttpResponse response = mock(ClientHttpResponse.class); ClientHttpConnector firstConnector = mock(ClientHttpConnector.class); - given(firstConnector.connect(any(), any(), any())).willReturn(Mono.empty()); + given(firstConnector.connect(any(), any(), any())) + .willReturn(Mono.just(response)); WebClient.Builder firstBuilder = this.context.getBean(WebClient.Builder.class); firstBuilder.clientConnector(firstConnector).baseUrl("http://first.example.org"); ClientHttpConnector secondConnector = mock(ClientHttpConnector.class); - given(secondConnector.connect(any(), any(), any())).willReturn(Mono.empty()); + given(secondConnector.connect(any(), any(), any())) + .willReturn(Mono.just(response)); WebClient.Builder secondBuilder = this.context.getBean(WebClient.Builder.class); secondBuilder.clientConnector(secondConnector) .baseUrl("http://second.example.org");