}
}
+ @Test
+ public void testError190()
+ {
+ log.info("testError190");
+
+ requestFactory.setBody("{\"error\":{\"message\":\"Bad signature\",\"type\":\"OAuthException\",\"code\":190,\"fbtrace_id\":\"Ay2OYQrINbXOCfQpBvoxDIw\"}}");
+
+ try
+ {
+ clientTemplate.getForObject("ANY", SOME.class);
+ fail("The expected exception was not thrown");
+ }
+ catch(AccessTokenExpiredException e)
+ {
+ log.debug("{}", e.toString());
+ assertEquals(new Integer(190), e.getCode());
+ assertEquals("Bad signature", e.getMessage());
+ assertEquals(Type.OAuthException, e.getType());
+ assertEquals("Ay2OYQrINbXOCfQpBvoxDIw", e.getTraceId());
+ }
+ }
+
+ @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()
{
clientTemplate.getForObject("ANY", SOME.class);
fail("The expected exception was not thrown");
}
- catch(CustomRequestLimitReachedException e)
+ catch(RateLimitExceededException e)
{
log.debug("{}", e.toString());
assertEquals(new Integer(613), e.getCode());
clientTemplate = new RestTemplate();
clientTemplate.setRequestFactory(requestFactory);
clientTemplate.setErrorHandler(
- new GraphApiErrorHandler(clientTemplate.getErrorHandler())
+ new GraphApiErrorResponseErrorHandler(clientTemplate.getErrorHandler())
);
}