WIP: WebClient
[facebook-errors] / src / test / java / de / juplo / facebook / errors / GraphApiExchangeFilterFunctionIntegrationTest.java
index 640fa6a..2e3ae22 100644 (file)
@@ -11,6 +11,8 @@ import org.junit.Before;
 import org.junit.Test;
 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.WebClient;
 import reactor.core.publisher.Mono;
 import reactor.test.StepVerifier;
@@ -36,6 +38,7 @@ public class GraphApiExchangeFilterFunctionIntegrationTest
     webClient =
         WebClient
             .builder()
+            .clientConnector(new JettyClientHttpConnector())
             .baseUrl(server.url("/").toString())
             .filter(GraphApiExchangeFilterFunction.INSTANCE)
             .build();
@@ -51,12 +54,9 @@ public class GraphApiExchangeFilterFunctionIntegrationTest
   @Test
   public void testValidError()
   {
-    LOG.info("testValidError");
-
-
     server
         .enqueue(new MockResponse()
-            .setStatus("400")
+            .setResponseCode(HttpStatus.BAD_REQUEST.value())
             .setHeader("Content-Type", "application/json")
             .setBody(
                 "{\n" +
@@ -87,6 +87,6 @@ public class GraphApiExchangeFilterFunctionIntegrationTest
           assertEquals("(#613) Calls to stream have exceeded the rate of 600 calls per 600 seconds.", e.getMessage());
           assertEquals(Type.OAuthException, e.getType());
         })
-        .verify(Duration.ofSeconds(3));
+        .verifyLater();
   }
 }