@ -16,8 +16,6 @@
@@ -16,8 +16,6 @@
package org.springframework.security.core.userdetails.jdbc ;
import static org.assertj.core.api.Assertions.* ;
import org.junit.Test ;
import org.springframework.security.PopulatedDatabase ;
@ -25,10 +23,14 @@ import org.springframework.security.core.authority.AuthorityUtils;
@@ -25,10 +23,14 @@ import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.UserDetails ;
import org.springframework.security.core.userdetails.UsernameNotFoundException ;
import static org.assertj.core.api.Assertions.assertThat ;
import static org.assertj.core.api.Assertions.fail ;
/ * *
* Tests { @link JdbcDaoImpl } .
*
* @author Ben Alex
* @author Eddú Meléndez
* /
public class JdbcDaoImplTests {
@ -60,10 +62,10 @@ public class JdbcDaoImplTests {
@@ -60,10 +62,10 @@ public class JdbcDaoImplTests {
assertThat ( user . getPassword ( ) ) . isEqualTo ( "koala" ) ;
assertThat ( user . isEnabled ( ) ) . isTrue ( ) ;
assertThat ( AuthorityUtils . authorityListToSet ( user . getAuthorities ( ) ) . contains (
"ROLE_TELLER" ) ) ;
assertThat ( AuthorityUtils . authorityListToSet ( user . getAuthorities ( ) ) . contains (
"ROLE_SUPERVISOR" ) ) ;
assertThat ( AuthorityUtils . authorityListToSet ( user . getAuthorities ( ) ) )
. contains ( "ROLE_TELLER" ) ;
assertThat ( AuthorityUtils . authorityListToSet ( user . getAuthorities ( ) ) )
. contains ( "ROLE_SUPERVISOR" ) ;
}
@Test
@ -71,8 +73,8 @@ public class JdbcDaoImplTests {
@@ -71,8 +73,8 @@ public class JdbcDaoImplTests {
JdbcDaoImpl dao = makePopulatedJdbcDao ( ) ;
UserDetails user = dao . loadUserByUsername ( "scott" ) ;
assertThat ( user . getAuthorities ( ) ) . hasSize ( 1 ) ;
assertThat ( AuthorityUtils . authorityListToSet ( user . getAuthorities ( ) ) . contains (
"ROLE_TELLER" ) ) ;
assertThat ( AuthorityUtils . authorityListToSet ( user . getAuthorities ( ) ) )
. contains ( "ROLE_TELLER" ) ;
}
@Test
@ -133,10 +135,10 @@ public class JdbcDaoImplTests {
@@ -133,10 +135,10 @@ public class JdbcDaoImplTests {
assertThat ( user . getUsername ( ) ) . isEqualTo ( "rod" ) ;
assertThat ( user . getAuthorities ( ) ) . hasSize ( 2 ) ;
assertThat ( AuthorityUtils . authorityListToSet ( user . getAuthorities ( ) ) . contains (
"ARBITRARY_PREFIX_ROLE_TELLER" ) ) ;
assertThat ( AuthorityUtils . authorityListToSet ( user . getAuthorities ( ) ) . contains (
"ARBITRARY_PREFIX_ROLE_SUPERVISOR" ) ) ;
assertThat ( AuthorityUtils . authorityListToSet ( user . getAuthorities ( ) ) )
. contains ( "ARBITRARY_PREFIX_ROLE_TELLER" ) ;
assertThat ( AuthorityUtils . authorityListToSet ( user . getAuthorities ( ) ) )
. contains ( "ARBITRARY_PREFIX_ROLE_SUPERVISOR" ) ;
}
@Test