SivaValidationServiceErrorHandler implements ResponseErrorHandler { @Override public boolean hasError(ClientHttpResponse clientHttpResponse) throws IOException { final HttpStatus.Series series = clientHttpResponse.getStatusCode().series(); return HttpStatus.Series.CLIENT_ERROR == series || HttpStatus.Series.SERVER_ERROR == series; }  @Override boolean hasError(ClientHttpResponse clientHttpResponse); @Override void handleError(ClientHttpResponse clientHttpResponse);  }
@Test public void givenNoneErrorCodeReturnsFalse() throws Exception { createResponse(HttpStatus.OK); assertFalse(errorHandler.hasError(httpResponse)); }
@Test public void givenClientErrorCodeReturnsTrue() throws Exception { createResponse(HttpStatus.BAD_REQUEST); assertTrue(errorHandler.hasError(httpResponse)); }
@Test public void givenServerErrorReturnsTrue() throws Exception { createResponse(HttpStatus.INTERNAL_SERVER_ERROR); assertTrue(errorHandler.hasError(httpResponse)); }