Skip to content

Commit 0a3eeb9

Browse files
philwebbrwinch
authored andcommitted
Remove incorrect AssertJ imports
Fix a few tests that were accidentally importing incorrect AssertJ classes. Issue gh-8945
1 parent a5aa6b3 commit 0a3eeb9

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

config/src/test/java/org/springframework/security/config/annotation/method/configuration/EnableReactiveMethodSecurityTests.java

+3-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package org.springframework.security.config.annotation.method.configuration;
1818

19-
import org.assertj.core.api.AssertionsForClassTypes;
2019
import org.junit.After;
2120
import org.junit.Test;
2221
import org.junit.runner.RunWith;
@@ -35,6 +34,7 @@
3534
import org.springframework.test.context.ContextConfiguration;
3635
import org.springframework.test.context.junit4.SpringRunner;
3736

37+
import static org.assertj.core.api.Assertions.assertThat;
3838
import static org.assertj.core.api.Assertions.assertThatThrownBy;
3939
import static org.mockito.BDDMockito.given;
4040
import static org.mockito.Mockito.mock;
@@ -200,8 +200,7 @@ public void fluxPreAuthorizeHasRoleWhenGrantedThenSuccess() {
200200
given(this.delegate.fluxPreAuthorizeHasRoleFindById(1L)).willReturn(Flux.just("result"));
201201
Flux<String> findById = this.messageService.fluxPreAuthorizeHasRoleFindById(1L)
202202
.subscriberContext(this.withAdmin);
203-
StepVerifier.create(findById).consumeNextWith((s) -> AssertionsForClassTypes.assertThat(s).isEqualTo("result"))
204-
.verifyComplete();
203+
StepVerifier.create(findById).consumeNextWith((s) -> assertThat(s).isEqualTo("result")).verifyComplete();
205204
}
206205

207206
@Test
@@ -305,8 +304,7 @@ public void publisherPreAuthorizeHasRoleWhenGrantedThenSuccess() {
305304
given(this.delegate.publisherPreAuthorizeHasRoleFindById(1L)).willReturn(publisherJust("result"));
306305
Publisher<String> findById = Flux.from(this.messageService.publisherPreAuthorizeHasRoleFindById(1L))
307306
.subscriberContext(this.withAdmin);
308-
StepVerifier.create(findById).consumeNextWith((s) -> AssertionsForClassTypes.assertThat(s).isEqualTo("result"))
309-
.verifyComplete();
307+
StepVerifier.create(findById).consumeNextWith((s) -> assertThat(s).isEqualTo("result")).verifyComplete();
310308
}
311309

312310
@Test

core/src/test/java/org/springframework/security/converter/RsaKeyConvertersTests.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@
2424
import java.security.interfaces.RSAPublicKey;
2525

2626
import org.assertj.core.api.Assertions;
27-
import org.assertj.core.api.AssertionsForClassTypes;
2827
import org.junit.Test;
2928

3029
import org.springframework.core.convert.converter.Converter;
3130

31+
import static org.assertj.core.api.Assertions.assertThatCode;
32+
3233
/**
3334
* Tests for {@link RsaKeyConverters}
3435
*/
@@ -98,7 +99,7 @@ public void pkcs8WhenConvertingPkcs8PrivateKeyThenOk() {
9899

99100
@Test
100101
public void pkcs8WhenConvertingPkcs1PrivateKeyThenIllegalArgumentException() {
101-
AssertionsForClassTypes.assertThatCode(() -> this.pkcs8.convert(toInputStream(PKCS1_PRIVATE_KEY)))
102+
assertThatCode(() -> this.pkcs8.convert(toInputStream(PKCS1_PRIVATE_KEY)))
102103
.isInstanceOf(IllegalArgumentException.class);
103104
}
104105

@@ -110,7 +111,7 @@ public void x509WhenConverteringX509PublicKeyThenOk() {
110111

111112
@Test
112113
public void x509WhenConvertingDerEncodedX509PublicKeyThenIllegalArgumentException() {
113-
AssertionsForClassTypes.assertThatCode(() -> this.x509.convert(toInputStream(MALFORMED_X509_KEY)))
114+
assertThatCode(() -> this.x509.convert(toInputStream(MALFORMED_X509_KEY)))
114115
.isInstanceOf(IllegalArgumentException.class);
115116
}
116117

oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/NimbusReactiveJwtDecoderTests.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
import com.nimbusds.jwt.SignedJWT;
4848
import okhttp3.mockwebserver.MockResponse;
4949
import okhttp3.mockwebserver.MockWebServer;
50-
import org.assertj.core.api.AssertionsForClassTypes;
5150
import org.junit.After;
5251
import org.junit.Before;
5352
import org.junit.BeforeClass;
@@ -345,7 +344,7 @@ public void withPublicKeyWhenUsingCustomTypeHeaderThenRefuseOmittedType() throws
345344
.jwtProcessorCustomizer(
346345
(p) -> p.setJWSTypeVerifier(new DefaultJOSEObjectTypeVerifier<>(new JOSEObjectType("JWS"))))
347346
.build();
348-
AssertionsForClassTypes.assertThatCode(() -> decoder.decode(this.rsa256).block())
347+
assertThatCode(() -> decoder.decode(this.rsa256).block())
349348
.isInstanceOf(BadJwtException.class)
350349
.hasRootCauseMessage("Required JOSE header \"typ\" (type) parameter is missing");
351350
}

0 commit comments

Comments
 (0)