}
- server
- .enqueue(new MockResponse()
- .setResponseCode(HttpStatus.BAD_REQUEST.value())
- .setHeader("Content-Type", "text/plain")
- .setBody("Hallo Welt!"));
-
- try
- {
- clientTemplate.getForObject(uri, String.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);
- }
-
-
server
.enqueue(new MockResponse()
.setResponseCode(HttpStatus.INTERNAL_SERVER_ERROR.value())
try
{
clientTemplate.getForObject(uri, String.class);
- fail("The expected exception was not thrown");
+ fail("The parent handler should have raised an exception!");
}
catch(HttpClientErrorException e)
{
- LOG.debug("{}", e.toString());
+ LOG.debug("Expexted error: {}", e.toString());
}
catch(Exception e)
{
- fail("A wrong exception was thrown: " + e.toString());
+ LOG.debug("{}", e.toString());
+ fail("Unexpected error: " + e);
}
try
{
clientTemplate.getForObject(uri, String.class);
- fail("The expected exception was not thrown");
+ fail("The parent handler should have raised an exception!");
}
catch(HttpClientErrorException e)
{
- LOG.debug("{}", e.toString());
+ LOG.debug("Expexted error: {}", e.toString());
}
catch(Exception e)
{
- fail("A wrong exception was thrown: " + e.toString());
+ LOG.debug("{}", e.toString());
+ fail("Unexpected error: " + e);
}
}
}