Support custom HTTP status in MockClientHttpResponse
See gh-28105
This commit is contained in:
@@ -128,6 +128,15 @@ class ResponseCreatorsTests {
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody()).length).isEqualTo(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
void withCustomStatus() throws Exception {
|
||||
DefaultResponseCreator responseCreator = MockRestResponseCreators.withStatus(454);
|
||||
MockClientHttpResponse response = (MockClientHttpResponse) responseCreator.createResponse(null);
|
||||
|
||||
assertThat(response.getRawStatusCode()).isEqualTo(454);
|
||||
assertThat(response.getStatusText()).isEqualTo("Custom http status");
|
||||
}
|
||||
|
||||
@Test
|
||||
void withException() {
|
||||
ResponseCreator responseCreator = MockRestResponseCreators.withException(new SocketTimeoutException());
|
||||
|
||||
Reference in New Issue
Block a user