Detect nulls within GrantedAuthority[] passed to constructor. This ensures end-user DAO implementations are creating the User correctly.
This commit is contained in:
@@ -84,6 +84,19 @@ public class UserTests extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testNullWithinGrantedAuthorityElementIsRejected()
|
||||
throws Exception {
|
||||
try {
|
||||
User user = new User(null, "koala", true,
|
||||
new GrantedAuthority[] {new GrantedAuthorityImpl("ROLE_ONE"), new GrantedAuthorityImpl(
|
||||
"ROLE_TWO"), null, new GrantedAuthorityImpl(
|
||||
"ROLE_THREE")});
|
||||
fail("Should have thrown IllegalArgumentException");
|
||||
} catch (IllegalArgumentException expected) {
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void testUserGettersSetter() throws Exception {
|
||||
User user = new User("marissa", "koala", true,
|
||||
new GrantedAuthority[] {new GrantedAuthorityImpl("ROLE_ONE"), new GrantedAuthorityImpl(
|
||||
|
||||
Reference in New Issue
Block a user