diff --git a/config/src/test/java/org/springframework/security/config/annotation/method/configuration/EnableReactiveMethodSecurityTests.java b/config/src/test/java/org/springframework/security/config/annotation/method/configuration/EnableReactiveMethodSecurityTests.java index 44e6e6a0d3..4a905ebe88 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/method/configuration/EnableReactiveMethodSecurityTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/method/configuration/EnableReactiveMethodSecurityTests.java @@ -16,7 +16,6 @@ package org.springframework.security.config.annotation.method.configuration; -import org.assertj.core.api.AssertionsForClassTypes; import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; @@ -35,6 +34,7 @@ import org.springframework.security.core.context.ReactiveSecurityContextHolder; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; +import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; @@ -200,8 +200,7 @@ public class EnableReactiveMethodSecurityTests { given(this.delegate.fluxPreAuthorizeHasRoleFindById(1L)).willReturn(Flux.just("result")); Flux findById = this.messageService.fluxPreAuthorizeHasRoleFindById(1L) .subscriberContext(this.withAdmin); - StepVerifier.create(findById).consumeNextWith((s) -> AssertionsForClassTypes.assertThat(s).isEqualTo("result")) - .verifyComplete(); + StepVerifier.create(findById).consumeNextWith((s) -> assertThat(s).isEqualTo("result")).verifyComplete(); } @Test @@ -305,8 +304,7 @@ public class EnableReactiveMethodSecurityTests { given(this.delegate.publisherPreAuthorizeHasRoleFindById(1L)).willReturn(publisherJust("result")); Publisher findById = Flux.from(this.messageService.publisherPreAuthorizeHasRoleFindById(1L)) .subscriberContext(this.withAdmin); - StepVerifier.create(findById).consumeNextWith((s) -> AssertionsForClassTypes.assertThat(s).isEqualTo("result")) - .verifyComplete(); + StepVerifier.create(findById).consumeNextWith((s) -> assertThat(s).isEqualTo("result")).verifyComplete(); } @Test diff --git a/core/src/test/java/org/springframework/security/converter/RsaKeyConvertersTests.java b/core/src/test/java/org/springframework/security/converter/RsaKeyConvertersTests.java index 62017aa038..17019a626f 100644 --- a/core/src/test/java/org/springframework/security/converter/RsaKeyConvertersTests.java +++ b/core/src/test/java/org/springframework/security/converter/RsaKeyConvertersTests.java @@ -24,11 +24,12 @@ import java.security.interfaces.RSAPrivateKey; import java.security.interfaces.RSAPublicKey; import org.assertj.core.api.Assertions; -import org.assertj.core.api.AssertionsForClassTypes; import org.junit.Test; import org.springframework.core.convert.converter.Converter; +import static org.assertj.core.api.Assertions.assertThatCode; + /** * Tests for {@link RsaKeyConverters} */ @@ -98,7 +99,7 @@ public class RsaKeyConvertersTests { @Test public void pkcs8WhenConvertingPkcs1PrivateKeyThenIllegalArgumentException() { - AssertionsForClassTypes.assertThatCode(() -> this.pkcs8.convert(toInputStream(PKCS1_PRIVATE_KEY))) + assertThatCode(() -> this.pkcs8.convert(toInputStream(PKCS1_PRIVATE_KEY))) .isInstanceOf(IllegalArgumentException.class); } @@ -110,7 +111,7 @@ public class RsaKeyConvertersTests { @Test public void x509WhenConvertingDerEncodedX509PublicKeyThenIllegalArgumentException() { - AssertionsForClassTypes.assertThatCode(() -> this.x509.convert(toInputStream(MALFORMED_X509_KEY))) + assertThatCode(() -> this.x509.convert(toInputStream(MALFORMED_X509_KEY))) .isInstanceOf(IllegalArgumentException.class); } diff --git a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/NimbusReactiveJwtDecoderTests.java b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/NimbusReactiveJwtDecoderTests.java index 237e3ba2c4..164877f904 100644 --- a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/NimbusReactiveJwtDecoderTests.java +++ b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/NimbusReactiveJwtDecoderTests.java @@ -47,7 +47,6 @@ import com.nimbusds.jwt.JWTClaimsSet; import com.nimbusds.jwt.SignedJWT; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; -import org.assertj.core.api.AssertionsForClassTypes; import org.junit.After; import org.junit.Before; import org.junit.BeforeClass; @@ -345,7 +344,7 @@ public class NimbusReactiveJwtDecoderTests { .jwtProcessorCustomizer( (p) -> p.setJWSTypeVerifier(new DefaultJOSEObjectTypeVerifier<>(new JOSEObjectType("JWS")))) .build(); - AssertionsForClassTypes.assertThatCode(() -> decoder.decode(this.rsa256).block()) + assertThatCode(() -> decoder.decode(this.rsa256).block()) .isInstanceOf(BadJwtException.class) .hasRootCauseMessage("Required JOSE header \"typ\" (type) parameter is missing"); }