Test with hasError for unknown status code
Issue: SPR-16108
This commit is contained in:
@@ -67,8 +67,8 @@ public class DefaultResponseErrorHandlerTests {
|
||||
handler.handleError(response);
|
||||
fail("expected HttpClientErrorException");
|
||||
}
|
||||
catch (HttpClientErrorException e) {
|
||||
assertSame(headers, e.getResponseHeaders());
|
||||
catch (HttpClientErrorException ex) {
|
||||
assertSame(headers, ex.getResponseHeaders());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,4 +109,16 @@ public class DefaultResponseErrorHandlerTests {
|
||||
handler.handleError(response);
|
||||
}
|
||||
|
||||
@Test // SPR-16108
|
||||
public void hasErrorForUnknownStatusCode() throws Exception {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.TEXT_PLAIN);
|
||||
|
||||
given(response.getRawStatusCode()).willReturn(999);
|
||||
given(response.getStatusText()).willReturn("Custom status code");
|
||||
given(response.getHeaders()).willReturn(headers);
|
||||
|
||||
assertFalse(handler.hasError(response));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user