From: Kai Moritz Date: Thu, 21 Nov 2019 19:56:19 +0000 (+0100) Subject: WIP: WebClient -- Methode benutzt, anstatt Funktion zu übergeben X-Git-Tag: wip-webclient~13 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=9a19a543217345145934e913b113c8e50f899ffd;p=facebook-errors WIP: WebClient -- Methode benutzt, anstatt Funktion zu übergeben --- 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()))