Fix ClassCastException for JDK 9+

AuthenticationPrincipalArgumentResolverTests failed in JDK 9+ due to
its improved generic support and a ClassCastException.

Issue gh-7363
This commit is contained in:
Rob Winch 2019-09-24 15:44:20 -05:00
parent ceab56f764
commit 45a1490d5d
1 changed files with 1 additions and 1 deletions

View File

@ -83,7 +83,7 @@ public class AuthenticationPrincipalArgumentResolverTests {
@Test @Test
public void resolveArgumentWhenExpressionThenFound() { public void resolveArgumentWhenExpressionThenFound() {
Authentication authentication = TestAuthentication.authenticatedUser(); Authentication authentication = TestAuthentication.authenticatedUser();
Mono<UserDetails> result = (Mono<UserDetails>) this.resolver.resolveArgument(arg0("authenticationPrincipalExpression"), null) Mono<String> result = (Mono<String>) this.resolver.resolveArgument(arg0("authenticationPrincipalExpression"), null)
.subscriberContext(ReactiveSecurityContextHolder.withAuthentication(authentication)) .subscriberContext(ReactiveSecurityContextHolder.withAuthentication(authentication))
.block(); .block();
assertThat(result.block()).isEqualTo(authentication.getName()); assertThat(result.block()).isEqualTo(authentication.getName());