X-Git-Url: https://juplo.de/gitweb/?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Fde%2Fjuplo%2Ffacebook%2Ferrors%2FGraphApiErrorResponseErrorHandlerIntegrationTest.java;h=254b51b6d9b37280179196d097b0575b0ecf6f32;hb=e378c374e11858a842a9b3608e6fb411689e91ce;hp=659337585754328be4f3e6fd75287759a23bd4bd;hpb=29d960306f0bea890cc1f02a4d66943d76013708;p=facebook-errors diff --git a/src/test/java/de/juplo/facebook/errors/GraphApiErrorResponseErrorHandlerIntegrationTest.java b/src/test/java/de/juplo/facebook/errors/GraphApiErrorResponseErrorHandlerIntegrationTest.java index 6593375..254b51b 100644 --- a/src/test/java/de/juplo/facebook/errors/GraphApiErrorResponseErrorHandlerIntegrationTest.java +++ b/src/test/java/de/juplo/facebook/errors/GraphApiErrorResponseErrorHandlerIntegrationTest.java @@ -10,6 +10,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.client.HttpServerErrorException; import org.springframework.web.client.RestTemplate; @@ -30,15 +31,7 @@ public class GraphApiErrorResponseErrorHandlerIntegrationTest @Test public void testNoError() { - LOG.info("testNoError"); - - 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" + - "}"); + requestFactory.setBody("{ \"message\": \"Hello World!\" }"); requestFactory.setStatus(HttpStatus.CONTINUE); @@ -74,10 +67,31 @@ public class GraphApiErrorResponseErrorHandlerIntegrationTest fail("Unexpected error: " + e); } + requestFactory.setStatus(HttpStatus.BAD_REQUEST); + try + { + clientTemplate.getForObject("ANY", SOME.class); + fail("The parent handler should have raised an exception!"); + } + catch(HttpClientErrorException e) + { + LOG.debug("Expexted error: {}", e.toString()); + } + catch(Exception e) + { + LOG.debug("{}", e.toString()); + fail("Unexpected error: " + e); + } + requestFactory.setStatus(HttpStatus.INTERNAL_SERVER_ERROR); try { clientTemplate.getForObject("ANY", SOME.class); + fail("The parent handler should have raised an exception!"); + } + catch(HttpServerErrorException e) + { + LOG.debug("Expexted error: {}", e.toString()); } catch(Exception e) { @@ -89,9 +103,6 @@ public class GraphApiErrorResponseErrorHandlerIntegrationTest @Test public void testValidError() { - LOG.info("testValidError"); - - requestFactory.setBody( "{\n" + " \"error\":\n" + @@ -119,9 +130,6 @@ public class GraphApiErrorResponseErrorHandlerIntegrationTest @Test public void testUnmappedError() { - LOG.info("testUnmappedError"); - - requestFactory.setBody( "{\n" + " \"error\":\n" + @@ -155,9 +163,6 @@ public class GraphApiErrorResponseErrorHandlerIntegrationTest @Test public void testInvlalidError() { - LOG.info("testInvalidError"); - - requestFactory.setBody( "{\n" + " \"error\":\n" +