Add toString() method and test.
This commit is contained in:
parent
e0d57de330
commit
ed68b701b2
|
@ -145,4 +145,12 @@ public class DaoAuthenticationToken extends AbstractAuthenticationToken
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(super.toString());
|
||||
sb.append("; Expires: " + this.expires.toString());
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -214,4 +214,13 @@ public class DaoAuthenticationTokenTests extends TestCase {
|
|||
token.setAuthenticated(false); // ignored
|
||||
assertTrue(token.isAuthenticated());
|
||||
}
|
||||
|
||||
public void testToString() {
|
||||
DaoAuthenticationToken token = new DaoAuthenticationToken("key",
|
||||
new Date(), "Test", "Password",
|
||||
new GrantedAuthority[] {new GrantedAuthorityImpl("ROLE_ONE"), new GrantedAuthorityImpl(
|
||||
"ROLE_TWO")});
|
||||
String result = token.toString();
|
||||
assertTrue(result.lastIndexOf("Expires:") != -1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue