@ -57,14 +57,14 @@ class ExtractingResponseErrorHandlerTests {
@@ -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 {
@@ -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 {
@@ -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 ) ;