- "{\n" +
- " \"error\":\n" +
- " {\n" +
- " \"message\": \"Not a Graph-Api-Exception.\",\n" +
- " \"type\": \"Whatever\",\n" +
- " \"code\": \"some string\"\n" +
- " }\n" +
- "}"));
+ "{\n" +
+ " \"error\":\n" +
+ " {\n" +
+ " \"message\": \"Not a Graph-Api-Exception.\",\n" +
+ " \"type\": \"Whatever\",\n" +
+ " \"code\": \"some string\"\n" +
+ " }\n" +
+ "}"));
+
+ try
+ {
+ clientTemplate.getForObject(uri, String.class);
+ fail("The expected exception was not thrown");
+ }
+ catch(HttpClientErrorException e)
+ {
+ LOG.debug("{}", e.toString());
+ }
+ catch(Exception e)
+ {
+ fail("A wrong exception was thrown: " + e.toString());
+ }
+
+
+ server
+ .enqueue(new MockResponse()
+ .setResponseCode(HttpStatus.BAD_REQUEST.value())
+ .setHeader("Content-Type", "text/plain")
+ .setBody("Hallo Welt!"));