Upgraded Spring Boot from 1.3.7.RELEASE to 2.2.0.RELEASE
[facebook-errors] / src / test / java / de / juplo / facebook / errors / GraphApiErrorHandlerTest.java
index 65149d5..2e03df7 100644 (file)
@@ -88,6 +88,37 @@ public class GraphApiErrorHandlerTest
     }
   }
 
+  @Test
+  public void testError4()
+  {
+    log.info("testError4");
+
+
+    requestFactory.setBody(
+        "{\n" +
+        "    \"error\": {\n" +
+        "        \"code\": 4, \n" +
+        "        \"fbtrace_id\": \"HZRM6BTMu+D\", \n" +
+        "        \"is_transient\": true, \n" +
+        "        \"message\": \"(#4) Application request limit reached\", \n" +
+        "        \"type\": \"OAuthException\"\n" +
+        "    }\n" +
+        "}\n");
+
+    try
+    {
+      clientTemplate.getForObject("ANY", SOME.class);
+      fail("The expected exception was not thrown");
+    }
+    catch(ApplicationRequestLimitReachedException e)
+    {
+      log.debug("{}", e.toString());
+      assertEquals(new Integer(4), e.getCode());
+      assertEquals("(#4) Application request limit reached", e.getMessage());
+      assertEquals(Type.OAuthException, e.getType());
+    }
+  }
+
   @Test
   public void testError12()
   {
@@ -722,7 +753,7 @@ public class GraphApiErrorHandlerTest
     clientTemplate = new RestTemplate();
     clientTemplate.setRequestFactory(requestFactory);
     clientTemplate.setErrorHandler(
-        new GraphApiErrorHandler(clientTemplate.getErrorHandler())
+        new GraphApiErrorResponseErrorHandler(clientTemplate.getErrorHandler())
         );
   }