200: The user hasn't authorized the application to perform this action
[facebook-errors] / src / test / java / de / juplo / facebook / errors / GraphApiErrorHandlerTest.java
index c9a53cd..c171956 100644 (file)
@@ -276,6 +276,34 @@ public class GraphApiErrorHandlerTest
     }
   }
 
+  @Test
+  public void testError200()
+  {
+    log.info("testError200");
+
+    requestFactory.setBody("{\n" +
+        "  \"error\": {\n" +
+        "    \"message\": \"(#200) The user hasn't authorized the application to perform this action\",\n" +
+        "    \"type\": \"OAuthException\",\n" +
+        "    \"code\": 200\n" +
+        "  }\n" +
+        "}");
+
+    try
+    {
+      clientTemplate.getForObject("ANY", SOME.class);
+      fail("The expected exception was not thrown");
+    }
+    catch(ApplicationNotAuthorizedByUserException e)
+    {
+      log.debug("{}", e.toString());
+      assertEquals(new Integer(200), e.getCode());
+      assertEquals("(#200) The user hasn't authorized the application to perform this action", e.getMessage());
+      assertEquals(Type.OAuthException, e.getType());
+      assertNull(e.getTraceId());
+    }
+  }
+
   @Test
   public void testError613()
   {