From 9a19a543217345145934e913b113c8e50f899ffd Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Thu, 21 Nov 2019 20:56:19 +0100 Subject: [PATCH] =?utf8?q?WIP:=20WebClient=20--=20Methode=20benutzt,=20ans?= =?utf8?q?tatt=20Funktion=20zu=20=C3=BCbergeben?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- ...GraphApiExchangeFilterFunctionIntegrationTest.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/test/java/de/juplo/facebook/errors/GraphApiExchangeFilterFunctionIntegrationTest.java b/src/test/java/de/juplo/facebook/errors/GraphApiExchangeFilterFunctionIntegrationTest.java index 6304665..a9ba58c 100644 --- a/src/test/java/de/juplo/facebook/errors/GraphApiExchangeFilterFunctionIntegrationTest.java +++ b/src/test/java/de/juplo/facebook/errors/GraphApiExchangeFilterFunctionIntegrationTest.java @@ -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 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())) -- 2.20.1