Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.springframework.security.config;

import static org.assertj.core.api.Assertions.*;
import static org.junit.Assert.fail;

import org.junit.After;
import org.junit.Test;
Expand Down Expand Up @@ -57,14 +58,15 @@ public void authenticationProviderCannotAppearAtTopLevel() {
public void missingAuthenticationManagerGivesSensibleErrorMessage() {
try {
setContext("<http auto-config='true' />");
fail();
}
catch (BeanCreationException e) {
Throwable cause = ultimateCause(e);
assertThat(cause instanceof NoSuchBeanDefinitionException).isTrue();
NoSuchBeanDefinitionException nsbe = (NoSuchBeanDefinitionException) cause;
assertThat(nsbe.getBeanName()).isEqualTo(BeanIds.AUTHENTICATION_MANAGER);
assertThat(nsbe.getMessage().endsWith(
AuthenticationManagerFactoryBean.MISSING_BEAN_ERROR_MESSAGE));
assertThat(nsbe.getMessage()).endsWith(
AuthenticationManagerFactoryBean.MISSING_BEAN_ERROR_MESSAGE);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public void issuerWhenAllInformationThenSuccess() throws Exception {
@Test
public void issuerWhenContainsTrailingSlashThenSuccess() throws Exception {
assertThat(registration("")).isNotNull();
assertThat(this.issuer.endsWith("/")).isTrue();
assertThat(this.issuer).endsWith("/");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void issuerWhenContainsTrailingSlashThenSuccess() {
prepareOpenIdConfigurationResponse();
this.server.enqueue(new MockResponse().setBody(JWK_SET));
assertThat(JwtDecoders.fromOidcIssuerLocation(this.issuer)).isNotNull();
assertThat(this.issuer.endsWith("/")).isTrue();
assertThat(this.issuer).endsWith("/");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void cookieShouldBeCorrectlyEncodedAndDecoded() throws Exception {

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

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