Added error 613: rate exceeded
[facebook-errors] / src / test / java / de / juplo / facebook / GraphApiErrorHandlerTest.java
index b9dc905..d93121b 100644 (file)
@@ -173,6 +173,37 @@ public class GraphApiErrorHandlerTest
     }
   }
 
+  @Test
+  public void testError613()
+  {
+    log.info("testError613");
+
+
+    requestFactory.setBody(
+        "{\n" +
+        "  \"error\":\n" +
+        "  {\n" +
+        "    \"message\": \"(#613) Calls to stream have exceeded the rate of 600 calls per 600 seconds.\",\n" +
+        "    \"type\": \"OAuthException\",\n" +
+        "    \"code\": 613\n" +
+        "  }\n" +
+        "}");
+
+    try
+    {
+      clientTemplate.getForObject("ANY", SOME.class);
+      fail("The expected exception was not thrown");
+    }
+    catch(RateExceededException e)
+    {
+      log.debug("{}", e.toString());
+      assertEquals("invalid_request", e.getOAuth2ErrorCode());
+      assertEquals(613, e.getCode());
+      assertEquals("(#613) Calls to stream have exceeded the rate of 600 calls per 600 seconds.", e.getMessage());
+      assertEquals("OAuthException", e.getType());
+    }
+  }
+
   @Test
   public void testUnmappedError()
   {