Update io.spring.javaformat to 0.0.27

Closes gh-9553
This commit is contained in:
Rob Winch 2021-04-05 22:03:45 -05:00
parent 7cc8dac37d
commit f3f1106624
5 changed files with 12 additions and 12 deletions

View File

@ -1,5 +1,5 @@
aspectjVersion=1.9.6 aspectjVersion=1.9.6
springJavaformatVersion=0.0.25 springJavaformatVersion=0.0.27
springBootVersion=2.4.2 springBootVersion=2.4.2
openSamlVersion=3.4.6 openSamlVersion=3.4.6
version=5.5.0-SNAPSHOT version=5.5.0-SNAPSHOT

View File

@ -38,8 +38,8 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.mock; import static org.mockito.BDDMockito.mock;
import static org.mockito.BDDMockito.when;
public class JwtDecoderProviderConfigurationUtilsTests { public class JwtDecoderProviderConfigurationUtilsTests {
@ -48,7 +48,7 @@ public class JwtDecoderProviderConfigurationUtilsTests {
JWKSource<SecurityContext> jwkSource = mock(JWKSource.class); JWKSource<SecurityContext> jwkSource = mock(JWKSource.class);
RSAKey key = new RSAKey.Builder(TestKeys.DEFAULT_PUBLIC_KEY).keyUse(KeyUse.SIGNATURE) RSAKey key = new RSAKey.Builder(TestKeys.DEFAULT_PUBLIC_KEY).keyUse(KeyUse.SIGNATURE)
.algorithm(JWSAlgorithm.RS384).build(); .algorithm(JWSAlgorithm.RS384).build();
when(jwkSource.get(any(JWKSelector.class), isNull())).thenReturn(Collections.singletonList(key)); given(jwkSource.get(any(JWKSelector.class), isNull())).willReturn(Collections.singletonList(key));
Set<SignatureAlgorithm> algorithms = JwtDecoderProviderConfigurationUtils.getSignatureAlgorithms(jwkSource); Set<SignatureAlgorithm> algorithms = JwtDecoderProviderConfigurationUtils.getSignatureAlgorithms(jwkSource);
assertThat(algorithms).containsOnly(SignatureAlgorithm.RS384); assertThat(algorithms).containsOnly(SignatureAlgorithm.RS384);
} }
@ -56,7 +56,7 @@ public class JwtDecoderProviderConfigurationUtilsTests {
@Test @Test
public void getSignatureAlgorithmsWhenJwkSetIsEmptyThenIllegalArgumentException() throws Exception { public void getSignatureAlgorithmsWhenJwkSetIsEmptyThenIllegalArgumentException() throws Exception {
JWKSource<SecurityContext> jwkSource = mock(JWKSource.class); JWKSource<SecurityContext> jwkSource = mock(JWKSource.class);
when(jwkSource.get(any(JWKSelector.class), isNull())).thenReturn(Collections.emptyList()); given(jwkSource.get(any(JWKSelector.class), isNull())).willReturn(Collections.emptyList());
assertThatIllegalArgumentException() assertThatIllegalArgumentException()
.isThrownBy(() -> JwtDecoderProviderConfigurationUtils.getSignatureAlgorithms(jwkSource)); .isThrownBy(() -> JwtDecoderProviderConfigurationUtils.getSignatureAlgorithms(jwkSource));
} }
@ -68,7 +68,7 @@ public class JwtDecoderProviderConfigurationUtilsTests {
ECKey ecKey = new ECKey.Builder(Curve.P_256, new Base64URL("3l2Da_flYc-AuUTm2QzxgyvJxYM_2TeB9DMlwz7j1PE"), ECKey ecKey = new ECKey.Builder(Curve.P_256, new Base64URL("3l2Da_flYc-AuUTm2QzxgyvJxYM_2TeB9DMlwz7j1PE"),
new Base64URL("-kjT7Wrfhwsi9SG6H4UXiyUiVE9GHCLauslksZ3-_t0")).keyUse(KeyUse.SIGNATURE).build(); new Base64URL("-kjT7Wrfhwsi9SG6H4UXiyUiVE9GHCLauslksZ3-_t0")).keyUse(KeyUse.SIGNATURE).build();
RSAKey rsaKey = new RSAKey.Builder(TestKeys.DEFAULT_PUBLIC_KEY).keyUse(KeyUse.ENCRYPTION).build(); RSAKey rsaKey = new RSAKey.Builder(TestKeys.DEFAULT_PUBLIC_KEY).keyUse(KeyUse.ENCRYPTION).build();
when(jwkSource.get(any(JWKSelector.class), isNull())).thenReturn(Arrays.asList(ecKey, rsaKey)); given(jwkSource.get(any(JWKSelector.class), isNull())).willReturn(Arrays.asList(ecKey, rsaKey));
Set<SignatureAlgorithm> algorithms = JwtDecoderProviderConfigurationUtils.getSignatureAlgorithms(jwkSource); Set<SignatureAlgorithm> algorithms = JwtDecoderProviderConfigurationUtils.getSignatureAlgorithms(jwkSource);
assertThat(algorithms).contains(SignatureAlgorithm.ES256, SignatureAlgorithm.ES384, SignatureAlgorithm.ES512); assertThat(algorithms).contains(SignatureAlgorithm.ES256, SignatureAlgorithm.ES384, SignatureAlgorithm.ES512);
} }

View File

@ -47,9 +47,9 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.mockito.BDDMockito.any; import static org.mockito.BDDMockito.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.mock; import static org.mockito.BDDMockito.mock;
import static org.mockito.BDDMockito.verify; import static org.mockito.BDDMockito.verify;
import static org.mockito.BDDMockito.when;
/** /**
* Tests for {@link JwtIssuerReactiveAuthenticationManagerResolver} * Tests for {@link JwtIssuerReactiveAuthenticationManagerResolver}
@ -129,7 +129,7 @@ public class JwtIssuerReactiveAuthenticationManagerResolverTests {
public void resolveWhenUsingCustomIssuerAuthenticationManagerResolverThenUses() { public void resolveWhenUsingCustomIssuerAuthenticationManagerResolverThenUses() {
Authentication token = withBearerToken(this.jwt); Authentication token = withBearerToken(this.jwt);
ReactiveAuthenticationManager authenticationManager = mock(ReactiveAuthenticationManager.class); ReactiveAuthenticationManager authenticationManager = mock(ReactiveAuthenticationManager.class);
when(authenticationManager.authenticate(token)).thenReturn(Mono.empty()); given(authenticationManager.authenticate(token)).willReturn(Mono.empty());
JwtIssuerReactiveAuthenticationManagerResolver authenticationManagerResolver = new JwtIssuerReactiveAuthenticationManagerResolver( JwtIssuerReactiveAuthenticationManagerResolver authenticationManagerResolver = new JwtIssuerReactiveAuthenticationManagerResolver(
(issuer) -> Mono.just(authenticationManager)); (issuer) -> Mono.just(authenticationManager));
authenticationManagerResolver.resolve(null).flatMap((manager) -> manager.authenticate(token)).block(); authenticationManagerResolver.resolve(null).flatMap((manager) -> manager.authenticate(token)).block();
@ -147,7 +147,7 @@ public class JwtIssuerReactiveAuthenticationManagerResolverTests {
.flatMap((manager) -> manager.authenticate(token)).block()) .flatMap((manager) -> manager.authenticate(token)).block())
.withMessageContaining("Invalid issuer"); .withMessageContaining("Invalid issuer");
ReactiveAuthenticationManager authenticationManager = mock(ReactiveAuthenticationManager.class); ReactiveAuthenticationManager authenticationManager = mock(ReactiveAuthenticationManager.class);
when(authenticationManager.authenticate(token)).thenReturn(Mono.empty()); given(authenticationManager.authenticate(token)).willReturn(Mono.empty());
authenticationManagers.put("trusted", authenticationManager); authenticationManagers.put("trusted", authenticationManager);
authenticationManagerResolver.resolve(null).flatMap((manager) -> manager.authenticate(token)).block(); authenticationManagerResolver.resolve(null).flatMap((manager) -> manager.authenticate(token)).block();
verify(authenticationManager).authenticate(token); verify(authenticationManager).authenticate(token);

View File

@ -40,9 +40,9 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.mock; import static org.mockito.BDDMockito.mock;
import static org.mockito.BDDMockito.verify; import static org.mockito.BDDMockito.verify;
import static org.mockito.BDDMockito.when;
/** /**
* @author Rob Winch * @author Rob Winch
@ -141,7 +141,7 @@ public class AuthenticationPrincipalArgumentResolverTests {
public void resolveArgumentSpelBean() throws Exception { public void resolveArgumentSpelBean() throws Exception {
CustomUserPrincipal principal = new CustomUserPrincipal(); CustomUserPrincipal principal = new CustomUserPrincipal();
setAuthenticationPrincipal(principal); setAuthenticationPrincipal(principal);
when(this.beanResolver.resolve(any(), eq("test"))).thenReturn(principal.property); given(this.beanResolver.resolve(any(), eq("test"))).willReturn(principal.property);
this.expectedPrincipal = principal.property; this.expectedPrincipal = principal.property;
assertThat(this.resolver.resolveArgument(showUserSpelBean(), null, null, null)) assertThat(this.resolver.resolveArgument(showUserSpelBean(), null, null, null))
.isEqualTo(this.expectedPrincipal); .isEqualTo(this.expectedPrincipal);

View File

@ -42,9 +42,9 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.mock; import static org.mockito.BDDMockito.mock;
import static org.mockito.BDDMockito.verify; import static org.mockito.BDDMockito.verify;
import static org.mockito.BDDMockito.when;
/** /**
* @author Dan Zheng * @author Dan Zheng
@ -119,7 +119,7 @@ public class CurrentSecurityContextArgumentResolverTests {
@Test @Test
public void resolveArgumentWithAuthenticationWithBean() throws Exception { public void resolveArgumentWithAuthenticationWithBean() throws Exception {
String principal = "john"; String principal = "john";
when(this.beanResolver.resolve(any(), eq("test"))).thenReturn(principal); given(this.beanResolver.resolve(any(), eq("test"))).willReturn(principal);
assertThat(this.resolver.resolveArgument(showSecurityContextAuthenticationWithBean(), null, null, null)) assertThat(this.resolver.resolveArgument(showSecurityContextAuthenticationWithBean(), null, null, null))
.isEqualTo(principal); .isEqualTo(principal);
verify(this.beanResolver).resolve(any(), eq("test")); verify(this.beanResolver).resolve(any(), eq("test"));