return new HttpClientErrorException.BadRequest(statusText, headers, body, charset); case UNAUTHORIZED: return new HttpClientErrorException.Unauthorized(statusText, headers, body, charset);
return new HttpClientErrorException.BadRequest(statusText, headers, body, charset); case UNAUTHORIZED: return new HttpClientErrorException.Unauthorized(statusText, headers, body, charset);
return new HttpClientErrorException.BadRequest(statusText, headers, body, charset); case UNAUTHORIZED: return new HttpClientErrorException.Unauthorized(statusText, headers, body, charset);
@Test public void badRequest() { try { template.execute(baseUrl + "/status/badrequest", HttpMethod.GET, null, null); fail("HttpClientErrorException.BadRequest expected"); } catch (HttpClientErrorException.BadRequest ex) { assertEquals(HttpStatus.BAD_REQUEST, ex.getStatusCode()); assertEquals("400 Client Error", ex.getMessage()); } }