WIP: WebClient -- Methode benutzt, anstatt Funktion zu übergeben
authorKai Moritz <kai@jupl.de>
Thu, 21 Nov 2019 19:56:19 +0000 (20:56 +0100)
committerKai Moritz <kai@jupl.de>
Thu, 21 Nov 2019 19:56:19 +0000 (20:56 +0100)
src/test/java/de/juplo/facebook/errors/GraphApiExchangeFilterFunctionIntegrationTest.java

index 6304665..a9ba58c 100644 (file)
@@ -11,10 +11,11 @@ import org.junit.Before;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.http.HttpHeaders;
 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.ClientRequest;
+import org.springframework.web.reactive.function.client.ClientResponse;
+import org.springframework.web.reactive.function.client.ExchangeFunction;
 import org.springframework.web.reactive.function.client.WebClient;
 import reactor.core.publisher.Mono;
 import reactor.test.StepVerifier;
@@ -42,7 +43,7 @@ public class GraphApiExchangeFilterFunctionIntegrationTest
             .builder()
             .clientConnector(new JettyClientHttpConnector())
             .baseUrl(server.url("/").toString())
-            .filter(errorHandlingFilter())
+            .filter(this::errorHandlingFilter)
             .build();
        }
 
@@ -130,9 +131,9 @@ public class GraphApiExchangeFilterFunctionIntegrationTest
                                .verify(Duration.ofSeconds(3));
   }
 
-  public static ExchangeFilterFunction errorHandlingFilter()
+  public Mono<ClientResponse> errorHandlingFilter(ClientRequest request, ExchangeFunction next)
   {
-    return (request, next) -> next.exchange(request).flatMap(response ->
+    return next.exchange(request).flatMap(response ->
     {
       if (response.statusCode() != null && (response.statusCode()
           .is5xxServerError() || response.statusCode().is4xxClientError()))