mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Clean up warnings related to deprecated HttpStatus values, etc.
This commit is contained in:
@@ -175,7 +175,7 @@ class ResponseEntityTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecate")
|
||||
@SuppressWarnings("deprecation")
|
||||
void unprocessableEntity() {
|
||||
ResponseEntity<String> responseEntity = ResponseEntity.unprocessableEntity().body("error");
|
||||
|
||||
|
||||
+1
@@ -86,6 +86,7 @@ class DefaultResponseErrorHandlerHttpStatusTests {
|
||||
.isThrownBy(() -> this.handler.handleError(URI.create("/"), HttpMethod.GET, this.response));
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
static Stream<Arguments> errorCodes() {
|
||||
return Stream.of(
|
||||
// 4xx
|
||||
|
||||
+4
-4
@@ -57,14 +57,14 @@ class ExtractingResponseErrorHandlerTests {
|
||||
HttpMessageConverter<Object> converter = new JacksonJsonHttpMessageConverter();
|
||||
this.errorHandler = new ExtractingResponseErrorHandler(List.of(converter));
|
||||
|
||||
this.errorHandler.setStatusMapping(Map.of(HttpStatus.I_AM_A_TEAPOT, MyRestClientException.class));
|
||||
this.errorHandler.setStatusMapping(Map.of(HttpStatus.EXPECTATION_FAILED, MyRestClientException.class));
|
||||
this.errorHandler.setSeriesMapping(Map.of(HttpStatus.Series.SERVER_ERROR, MyRestClientException.class));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void hasError() throws Exception {
|
||||
given(this.response.getStatusCode()).willReturn(HttpStatus.I_AM_A_TEAPOT);
|
||||
given(this.response.getStatusCode()).willReturn(HttpStatus.EXPECTATION_FAILED);
|
||||
assertThat(this.errorHandler.hasError(this.response)).isTrue();
|
||||
|
||||
given(this.response.getStatusCode()).willReturn(HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
@@ -78,7 +78,7 @@ class ExtractingResponseErrorHandlerTests {
|
||||
void hasErrorOverride() throws Exception {
|
||||
this.errorHandler.setSeriesMapping(Collections.singletonMap(HttpStatus.Series.CLIENT_ERROR, null));
|
||||
|
||||
given(this.response.getStatusCode()).willReturn(HttpStatus.I_AM_A_TEAPOT);
|
||||
given(this.response.getStatusCode()).willReturn(HttpStatus.EXPECTATION_FAILED);
|
||||
assertThat(this.errorHandler.hasError(this.response)).isTrue();
|
||||
|
||||
given(this.response.getStatusCode()).willReturn(HttpStatus.NOT_FOUND);
|
||||
@@ -90,7 +90,7 @@ class ExtractingResponseErrorHandlerTests {
|
||||
|
||||
@Test
|
||||
void handleErrorStatusMatch() throws Exception {
|
||||
given(this.response.getStatusCode()).willReturn(HttpStatus.I_AM_A_TEAPOT);
|
||||
given(this.response.getStatusCode()).willReturn(HttpStatus.EXPECTATION_FAILED);
|
||||
HttpHeaders responseHeaders = new HttpHeaders();
|
||||
responseHeaders.setContentType(MediaType.APPLICATION_JSON);
|
||||
given(this.response.getHeaders()).willReturn(responseHeaders);
|
||||
|
||||
Reference in New Issue
Block a user