X-Git-Url: https://juplo.de/gitweb/?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Fde%2Fjuplo%2Ffacebook%2Ferrors%2FGraphApiExchangeFilterFunctionIntegrationTest.java;h=c468590c7fc5126e3757b30c03d8977280672695;hb=904813dd6f8362f2d7aae87bad164108b3a42004;hp=743f6be3a66f32b0d4cd66825c97bbe3525407aa;hpb=57e8fca38ddbef8e14edf444ddeb5f1087167ef9;p=facebook-errors diff --git a/src/test/java/de/juplo/facebook/errors/GraphApiExchangeFilterFunctionIntegrationTest.java b/src/test/java/de/juplo/facebook/errors/GraphApiExchangeFilterFunctionIntegrationTest.java index 743f6be..c468590 100644 --- a/src/test/java/de/juplo/facebook/errors/GraphApiExchangeFilterFunctionIntegrationTest.java +++ b/src/test/java/de/juplo/facebook/errors/GraphApiExchangeFilterFunctionIntegrationTest.java @@ -103,18 +103,20 @@ public class GraphApiExchangeFilterFunctionIntegrationTest .filter((request, next) -> next.exchange(request).flatMap(response -> { List headerValues = response.headers().header("Foo"); - return headerValues.isEmpty() ? Mono.error( - new Exception("Response does not contain Foo header")) : + return headerValues.isEmpty() ? Mono.error(GraphApiException.create(response)) : Mono.just(response); })) .build(); server .enqueue(new MockResponse() + .setResponseCode(200) .setHeader("Content-Type", "text/plain") .setBody("Hello Spring!")); - Mono result = webClient.get() + Mono result; + + result = webClient.get() .uri("/greeting?name=Spring") .retrieve() .bodyToMono(String.class); @@ -122,5 +124,22 @@ public class GraphApiExchangeFilterFunctionIntegrationTest StepVerifier.create(result) .expectError(Exception.class) .verify(Duration.ofSeconds(3)); + + server + .enqueue(new MockResponse() + .setResponseCode(200) + .setHeader("Content-Type", "text/plain") + .setHeader("Foo", "Bar") + .setBody("Hello Spring!")); + + result = webClient.get() + .uri("/greeting?name=Spring") + .retrieve() + .bodyToMono(String.class); + + StepVerifier.create(result) + .expectNext("Hello Spring!") + .expectComplete() + .verify(Duration.ofSeconds(3)); } }