Skip to content

Commit c94f13a

Browse files
izeyerwinch
authored andcommitted
Polish tests
1 parent 1a02caf commit c94f13a

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

config/src/test/java/org/springframework/security/config/InvalidConfigurationTests.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package org.springframework.security.config;
1717

1818
import static org.assertj.core.api.Assertions.*;
19+
import static org.junit.Assert.fail;
1920

2021
import org.junit.After;
2122
import org.junit.Test;
@@ -57,14 +58,15 @@ public void authenticationProviderCannotAppearAtTopLevel() {
5758
public void missingAuthenticationManagerGivesSensibleErrorMessage() {
5859
try {
5960
setContext("<http auto-config='true' />");
61+
fail();
6062
}
6163
catch (BeanCreationException e) {
6264
Throwable cause = ultimateCause(e);
6365
assertThat(cause instanceof NoSuchBeanDefinitionException).isTrue();
6466
NoSuchBeanDefinitionException nsbe = (NoSuchBeanDefinitionException) cause;
6567
assertThat(nsbe.getBeanName()).isEqualTo(BeanIds.AUTHENTICATION_MANAGER);
66-
assertThat(nsbe.getMessage().endsWith(
67-
AuthenticationManagerFactoryBean.MISSING_BEAN_ERROR_MESSAGE));
68+
assertThat(nsbe.getMessage()).endsWith(
69+
AuthenticationManagerFactoryBean.MISSING_BEAN_ERROR_MESSAGE);
6870
}
6971
}
7072

oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/registration/ClientRegistrationsTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public void issuerWhenAllInformationThenSuccess() throws Exception {
140140
@Test
141141
public void issuerWhenContainsTrailingSlashThenSuccess() throws Exception {
142142
assertThat(registration("")).isNotNull();
143-
assertThat(this.issuer.endsWith("/")).isTrue();
143+
assertThat(this.issuer).endsWith("/");
144144
}
145145

146146
/**

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public void issuerWhenContainsTrailingSlashThenSuccess() {
9797
prepareOpenIdConfigurationResponse();
9898
this.server.enqueue(new MockResponse().setBody(JWK_SET));
9999
assertThat(JwtDecoders.fromOidcIssuerLocation(this.issuer)).isNotNull();
100-
assertThat(this.issuer.endsWith("/")).isTrue();
100+
assertThat(this.issuer).endsWith("/");
101101
}
102102

103103
@Test

web/src/test/java/org/springframework/security/web/authentication/rememberme/AbstractRememberMeServicesTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public void cookieShouldBeCorrectlyEncodedAndDecoded() throws Exception {
9292

9393
String encoded = services.encodeCookie(cookie);
9494
// '=' aren't allowed in version 0 cookies.
95-
assertThat(encoded.endsWith("=")).isFalse();
95+
assertThat(encoded).doesNotEndWith("=");
9696
String[] decoded = services.decodeCookie(encoded);
9797

9898
assertThat(decoded).containsExactly("name:with:colon", "cookie", "tokens", "blah");

0 commit comments

Comments
 (0)