Remove incorrect AssertJ imports
Fix a few tests that were accidentally importing incorrect AssertJ classes. Issue gh-8945
This commit is contained in:
parent
a5aa6b3d7f
commit
0a3eeb9c80
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
package org.springframework.security.config.annotation.method.configuration;
|
package org.springframework.security.config.annotation.method.configuration;
|
||||||
|
|
||||||
import org.assertj.core.api.AssertionsForClassTypes;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
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.ContextConfiguration;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
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.assertj.core.api.Assertions.assertThatThrownBy;
|
||||||
import static org.mockito.BDDMockito.given;
|
import static org.mockito.BDDMockito.given;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
|
@ -200,8 +200,7 @@ public class EnableReactiveMethodSecurityTests {
|
||||||
given(this.delegate.fluxPreAuthorizeHasRoleFindById(1L)).willReturn(Flux.just("result"));
|
given(this.delegate.fluxPreAuthorizeHasRoleFindById(1L)).willReturn(Flux.just("result"));
|
||||||
Flux<String> findById = this.messageService.fluxPreAuthorizeHasRoleFindById(1L)
|
Flux<String> findById = this.messageService.fluxPreAuthorizeHasRoleFindById(1L)
|
||||||
.subscriberContext(this.withAdmin);
|
.subscriberContext(this.withAdmin);
|
||||||
StepVerifier.create(findById).consumeNextWith((s) -> AssertionsForClassTypes.assertThat(s).isEqualTo("result"))
|
StepVerifier.create(findById).consumeNextWith((s) -> assertThat(s).isEqualTo("result")).verifyComplete();
|
||||||
.verifyComplete();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -305,8 +304,7 @@ public class EnableReactiveMethodSecurityTests {
|
||||||
given(this.delegate.publisherPreAuthorizeHasRoleFindById(1L)).willReturn(publisherJust("result"));
|
given(this.delegate.publisherPreAuthorizeHasRoleFindById(1L)).willReturn(publisherJust("result"));
|
||||||
Publisher<String> findById = Flux.from(this.messageService.publisherPreAuthorizeHasRoleFindById(1L))
|
Publisher<String> findById = Flux.from(this.messageService.publisherPreAuthorizeHasRoleFindById(1L))
|
||||||
.subscriberContext(this.withAdmin);
|
.subscriberContext(this.withAdmin);
|
||||||
StepVerifier.create(findById).consumeNextWith((s) -> AssertionsForClassTypes.assertThat(s).isEqualTo("result"))
|
StepVerifier.create(findById).consumeNextWith((s) -> assertThat(s).isEqualTo("result")).verifyComplete();
|
||||||
.verifyComplete();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -24,11 +24,12 @@ import java.security.interfaces.RSAPrivateKey;
|
||||||
import java.security.interfaces.RSAPublicKey;
|
import java.security.interfaces.RSAPublicKey;
|
||||||
|
|
||||||
import org.assertj.core.api.Assertions;
|
import org.assertj.core.api.Assertions;
|
||||||
import org.assertj.core.api.AssertionsForClassTypes;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import org.springframework.core.convert.converter.Converter;
|
import org.springframework.core.convert.converter.Converter;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThatCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link RsaKeyConverters}
|
* Tests for {@link RsaKeyConverters}
|
||||||
*/
|
*/
|
||||||
|
@ -98,7 +99,7 @@ public class RsaKeyConvertersTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void pkcs8WhenConvertingPkcs1PrivateKeyThenIllegalArgumentException() {
|
public void pkcs8WhenConvertingPkcs1PrivateKeyThenIllegalArgumentException() {
|
||||||
AssertionsForClassTypes.assertThatCode(() -> this.pkcs8.convert(toInputStream(PKCS1_PRIVATE_KEY)))
|
assertThatCode(() -> this.pkcs8.convert(toInputStream(PKCS1_PRIVATE_KEY)))
|
||||||
.isInstanceOf(IllegalArgumentException.class);
|
.isInstanceOf(IllegalArgumentException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +111,7 @@ public class RsaKeyConvertersTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void x509WhenConvertingDerEncodedX509PublicKeyThenIllegalArgumentException() {
|
public void x509WhenConvertingDerEncodedX509PublicKeyThenIllegalArgumentException() {
|
||||||
AssertionsForClassTypes.assertThatCode(() -> this.x509.convert(toInputStream(MALFORMED_X509_KEY)))
|
assertThatCode(() -> this.x509.convert(toInputStream(MALFORMED_X509_KEY)))
|
||||||
.isInstanceOf(IllegalArgumentException.class);
|
.isInstanceOf(IllegalArgumentException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,6 @@ import com.nimbusds.jwt.JWTClaimsSet;
|
||||||
import com.nimbusds.jwt.SignedJWT;
|
import com.nimbusds.jwt.SignedJWT;
|
||||||
import okhttp3.mockwebserver.MockResponse;
|
import okhttp3.mockwebserver.MockResponse;
|
||||||
import okhttp3.mockwebserver.MockWebServer;
|
import okhttp3.mockwebserver.MockWebServer;
|
||||||
import org.assertj.core.api.AssertionsForClassTypes;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
@ -345,7 +344,7 @@ public class NimbusReactiveJwtDecoderTests {
|
||||||
.jwtProcessorCustomizer(
|
.jwtProcessorCustomizer(
|
||||||
(p) -> p.setJWSTypeVerifier(new DefaultJOSEObjectTypeVerifier<>(new JOSEObjectType("JWS"))))
|
(p) -> p.setJWSTypeVerifier(new DefaultJOSEObjectTypeVerifier<>(new JOSEObjectType("JWS"))))
|
||||||
.build();
|
.build();
|
||||||
AssertionsForClassTypes.assertThatCode(() -> decoder.decode(this.rsa256).block())
|
assertThatCode(() -> decoder.decode(this.rsa256).block())
|
||||||
.isInstanceOf(BadJwtException.class)
|
.isInstanceOf(BadJwtException.class)
|
||||||
.hasRootCauseMessage("Required JOSE header \"typ\" (type) parameter is missing");
|
.hasRootCauseMessage("Required JOSE header \"typ\" (type) parameter is missing");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue