WIP: WebClient
authorKai Moritz <kai@jupl.de>
Thu, 21 Nov 2019 16:12:18 +0000 (17:12 +0100)
committerKai Moritz <kai@jupl.de>
Thu, 21 Nov 2019 16:14:46 +0000 (17:14 +0100)
src/test/java/de/juplo/facebook/errors/GraphApiExchangeFilterFunctionIntegrationTest.java

index b90e057..4e07259 100644 (file)
@@ -14,7 +14,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.client.reactive.JettyClientHttpConnector;
-import org.springframework.web.reactive.function.client.ExchangeFilterFunction;
 import org.springframework.web.reactive.function.client.WebClient;
 import reactor.core.publisher.Mono;
 import reactor.test.StepVerifier;
@@ -42,7 +41,6 @@ public class GraphApiExchangeFilterFunctionIntegrationTest
             .builder()
             .clientConnector(new JettyClientHttpConnector())
             .baseUrl(server.url("/").toString())
-            .filter(GraphApiExchangeFilterFunction.INSTANCE)
             .build();
        }
 
@@ -76,6 +74,7 @@ public class GraphApiExchangeFilterFunctionIntegrationTest
             .get()
             .uri("/egal")
             .retrieve()
+            .onStatus(status -> status.is4xxClientError(), response -> GraphApiException.create(response))
             .bodyToMono(String.class);
 
     StepVerifier
@@ -110,7 +109,7 @@ public class GraphApiExchangeFilterFunctionIntegrationTest
 
     server
         .enqueue(new MockResponse()
-            .setResponseCode(200)
+            .setResponseCode(400)
             .setHeader("Content-Type", "text/plain")
             .setBody("Hello Spring!"));
 
@@ -119,6 +118,7 @@ public class GraphApiExchangeFilterFunctionIntegrationTest
     result = webClient.get()
                                .uri("/greeting?name=Spring")
                                .retrieve()
+        .onStatus(status -> status.is4xxClientError(), response -> GraphApiException.create(response))
                                .bodyToMono(String.class);
 
                StepVerifier.create(result)