Remove incorrect AssertJ imports

Fix a few tests that were accidentally importing incorrect AssertJ
classes.

Issue gh-8945
This commit is contained in:
Phillip Webb 2020-08-04 10:49:27 -07:00 committed by Rob Winch
parent a5aa6b3d7f
commit 0a3eeb9c80
3 changed files with 8 additions and 10 deletions

View File

@ -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<String> 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<String> 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

View File

@ -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);
}

View File

@ -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");
}