Added/Renamed the exceptions, that are thrown, if the rate-limit is exceeded
[facebook-errors] / src / test / java / de / juplo / facebook / errors / GraphApiErrorHandlerTest.java
index 65149d5..185fd2b 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()
   {
@@ -244,7 +275,7 @@ public class GraphApiErrorHandlerTest
       clientTemplate.getForObject("ANY", SOME.class);
       fail("The expected exception was not thrown");
     }
-    catch(RateLimitExceededException e)
+    catch(CustomRequestLimitReachedException e)
     {
       log.debug("{}", e.toString());
       assertEquals(new Integer(613), e.getCode());