@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
/ *
* Copyright 2002 - 2018 the original author or authors .
* Copyright 2002 - 202 1 the original author or authors .
*
* Licensed under the Apache License , Version 2 . 0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
@ -58,4 +58,13 @@ public class OAuth2ErrorResponseErrorHandlerTests {
@@ -58,4 +58,13 @@ public class OAuth2ErrorResponseErrorHandlerTests {
. withMessage ( "[insufficient_scope] The access token expired" ) ;
}
@Test
public void handleErrorWhenErrorResponseWithInvalidWwwAuthenticateHeaderThenHandled ( ) {
String invalidWwwAuthenticateHeader = "Unauthorized" ;
MockClientHttpResponse response = new MockClientHttpResponse ( new byte [ 0 ] , HttpStatus . BAD_REQUEST ) ;
response . getHeaders ( ) . add ( HttpHeaders . WWW_AUTHENTICATE , invalidWwwAuthenticateHeader ) ;
assertThatExceptionOfType ( OAuth2AuthorizationException . class )
. isThrownBy ( ( ) - > this . errorHandler . handleError ( response ) ) . withMessage ( "[server_error] " ) ;
}
}