Skip to content

Commit 4e34939

Browse files
committed
Cover deserialization failure
1 parent 72eaacf commit 4e34939

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/jackson2/OAuth2AuthenticationExceptionMixinTests.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ public void serializeWhenRequiredAttributesOnlyThenSerializes() throws JsonProce
7171
JSONAssert.assertEquals(expected, serializedJson, true);
7272
}
7373

74+
@Test
75+
public void deserializeWhenMixinNotRegisteredThenThrowJsonProcessingException() {
76+
String json = asJson(new OAuth2AuthenticationException(
77+
new OAuth2Error("[authorization_request_not_found] ")
78+
));
79+
assertThatThrownBy(() -> new ObjectMapper().readValue(json, OAuth2AuthorizationRequest.class))
80+
.isInstanceOf(JsonProcessingException.class);
81+
}
82+
7483
@Test
7584
public void deserializeWhenMixinRegisteredThenDeserializes() throws IOException {
7685
OAuth2AuthenticationException expected = new OAuth2AuthenticationException(new OAuth2Error(

0 commit comments

Comments
 (0)