+ 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 expected exception was not thrown");
+ }
+ catch(HttpClientErrorException e)
+ {
+ LOG.debug("{}", e.toString());
+ }
+ catch(Exception e)
+ {
+ fail("A wrong exception was thrown: " + e.toString());
+ }