Fix test assertions
This commit is contained in:
+7
-6
@@ -42,6 +42,7 @@ import org.springframework.security.ldap.userdetails.LdapUserDetailsMapper;
|
||||
*
|
||||
* @author Luke Taylor
|
||||
* @author Rob Winch
|
||||
* @author Eddú Meléndez
|
||||
*/
|
||||
public class LdapAuthenticationProviderTests {
|
||||
|
||||
@@ -137,10 +138,10 @@ public class LdapAuthenticationProviderTests {
|
||||
assertThat(user.getUsername()).isEqualTo("ben");
|
||||
assertThat(populator.getRequestedUsername()).isEqualTo("ben");
|
||||
|
||||
assertThat(AuthorityUtils.authorityListToSet(user.getAuthorities()).contains(
|
||||
"ROLE_FROM_ENTRY"));
|
||||
assertThat(AuthorityUtils.authorityListToSet(user.getAuthorities()).contains(
|
||||
"ROLE_FROM_POPULATOR"));
|
||||
assertThat(AuthorityUtils.authorityListToSet(user.getAuthorities()))
|
||||
.contains("ROLE_FROM_ENTRY");
|
||||
assertThat(AuthorityUtils.authorityListToSet(user.getAuthorities()))
|
||||
.contains("ROLE_FROM_POPULATOR");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -168,8 +169,8 @@ public class LdapAuthenticationProviderTests {
|
||||
UserDetails user = (UserDetails) ldapProvider.authenticate(authRequest)
|
||||
.getPrincipal();
|
||||
assertThat(user.getAuthorities()).hasSize(1);
|
||||
assertThat(AuthorityUtils.authorityListToSet(user.getAuthorities()).contains(
|
||||
"ROLE_FROM_ENTRY"));
|
||||
assertThat(AuthorityUtils.authorityListToSet(user.getAuthorities()))
|
||||
.contains("ROLE_FROM_ENTRY");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+5
-4
@@ -16,20 +16,22 @@
|
||||
|
||||
package org.springframework.security.ldap.userdetails;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import javax.naming.directory.BasicAttribute;
|
||||
import javax.naming.directory.BasicAttributes;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.ldap.core.DirContextAdapter;
|
||||
import org.springframework.ldap.core.DistinguishedName;
|
||||
import org.springframework.security.core.authority.AuthorityUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests {@link LdapUserDetailsMapper}.
|
||||
*
|
||||
* @author Luke Taylor
|
||||
* @author Eddú Meléndez
|
||||
*/
|
||||
public class LdapUserDetailsMapperTests {
|
||||
|
||||
@@ -72,8 +74,7 @@ public class LdapUserDetailsMapperTests {
|
||||
"ani", AuthorityUtils.NO_AUTHORITIES);
|
||||
|
||||
assertThat(user.getAuthorities()).hasSize(1);
|
||||
assertThat(AuthorityUtils.authorityListToSet(user.getAuthorities()).contains(
|
||||
"ROLE_X"));
|
||||
assertThat(AuthorityUtils.authorityListToSet(user.getAuthorities())).contains("ROLE_X");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user