@ -57,15 +57,15 @@ class DefaultResponseErrorHandlerHttpStatusTests {
private final ClientHttpResponse response = mock ( ClientHttpResponse . class ) ;
private final ClientHttpResponse response = mock ( ClientHttpResponse . class ) ;
@ParameterizedTest ( name = "error: [{0}], exception: [{1 }]" )
@ParameterizedTest ( name = "[{index}] error: [{0 }]" )
@DisplayName ( "hasError() returns true" )
@DisplayName ( "hasError() returns true" )
@MethodSource ( "errorCodes" )
@MethodSource ( "errorCodes" )
void hasErrorTrue ( HttpStatus httpStatus , Class < ? extends Throwable > expectedExceptionClass ) throws Exception {
void hasErrorTrue ( HttpStatus httpStatus ) throws Exception {
given ( this . response . getRawStatusCode ( ) ) . willReturn ( httpStatus . value ( ) ) ;
given ( this . response . getRawStatusCode ( ) ) . willReturn ( httpStatus . value ( ) ) ;
assertThat ( this . handler . hasError ( this . response ) ) . isTrue ( ) ;
assertThat ( this . handler . hasError ( this . response ) ) . isTrue ( ) ;
}
}
@ParameterizedTest ( name = "error: [{0}], exception: [{1}]" )
@ParameterizedTest ( name = "[{index}] error: [{0}], exception: [{1}]" )
@DisplayName ( "handleError() throws an exception" )
@DisplayName ( "handleError() throws an exception" )
@MethodSource ( "errorCodes" )
@MethodSource ( "errorCodes" )
void handleErrorException ( HttpStatus httpStatus , Class < ? extends Throwable > expectedExceptionClass ) throws Exception {
void handleErrorException ( HttpStatus httpStatus , Class < ? extends Throwable > expectedExceptionClass ) throws Exception {
@ -75,8 +75,7 @@ class DefaultResponseErrorHandlerHttpStatusTests {
given ( this . response . getRawStatusCode ( ) ) . willReturn ( httpStatus . value ( ) ) ;
given ( this . response . getRawStatusCode ( ) ) . willReturn ( httpStatus . value ( ) ) ;
given ( this . response . getHeaders ( ) ) . willReturn ( headers ) ;
given ( this . response . getHeaders ( ) ) . willReturn ( headers ) ;
assertThatExceptionOfType ( expectedExceptionClass ) . isThrownBy ( ( ) - >
assertThatExceptionOfType ( expectedExceptionClass ) . isThrownBy ( ( ) - > this . handler . handleError ( this . response ) ) ;
this . handler . handleError ( this . response ) ) ;
}
}
static Object [ ] [ ] errorCodes ( ) {
static Object [ ] [ ] errorCodes ( ) {