Implemented new exception CallbackVerificationFailedException
[facebook-errors] / src / test / java / de / juplo / facebook / client / GraphApiErrorHandlerTest.java
index 3917404..f0c26e9 100644 (file)
@@ -1,6 +1,7 @@
 package de.juplo.facebook.client;
 
 import de.juplo.facebook.exceptions.AccessTokenRequiredException;
+import de.juplo.facebook.exceptions.CallbackVerificationFailedException;
 import de.juplo.facebook.exceptions.UnsupportedGetRequestException;
 import de.juplo.facebook.exceptions.UnexpectedErrorException;
 import de.juplo.facebook.exceptions.RateExceededException;
@@ -234,6 +235,27 @@ public class GraphApiErrorHandlerTest
     }
   }
 
+  @Test
+  public void testError2200()
+  {
+    requestFactory.setBody("{\"error\":{\"message\":\"(#2200) callback verification failed: \",\"type\":\"OAuthException\",\"code\":2200,\"fbtrace_id\":\"ESLjoZKvPXg\"}}");
+    
+    try
+    {
+      clientTemplate.getForObject("ANY", SOME.class);
+      fail("The expected exception was not thrown");
+    }
+    catch(CallbackVerificationFailedException e)
+    {
+      log.debug("{}", e.toString());
+      assertEquals("invalid_request", e.getOAuth2ErrorCode());
+      assertEquals(new Integer(2200), e.getCode());
+      assertEquals("(#2200) callback verification failed: ", e.getMessage());
+      assertEquals(Type.OAuthException, e.getType());
+      assertEquals("ESLjoZKvPXg", e.getTraceId());
+    }
+  }
+
   @Test
   public void testUnmappedError()
   {