Removed no-arg constructor from UsernamePasswordAuthenticationToken.

This commit is contained in:
Luke Taylor 2005-12-22 01:16:16 +00:00
parent c378779610
commit 8f725f7a74
2 changed files with 6 additions and 8 deletions

View File

@ -78,10 +78,6 @@ public class UsernamePasswordAuthenticationToken
this.authenticated = true;
}
protected UsernamePasswordAuthenticationToken() {
throw new IllegalArgumentException("Cannot use default constructor");
}
//~ Methods ================================================================
public void setAuthenticated(boolean isAuthenticated)

View File

@ -88,11 +88,13 @@ public class UsernamePasswordAuthenticationTokenTests extends TestCase {
assertEquals("ROLE_TWO", token.getAuthorities()[1].getAuthority());
}
public void testNoArgConstructor() {
public void testNoArgConstructorDoesntExist() {
Class clazz = UsernamePasswordAuthenticationToken.class;
try {
new UsernamePasswordAuthenticationToken();
fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException expected) {
clazz.getDeclaredConstructor(null);
fail("Should have thrown NoSuchMethodException");
} catch (NoSuchMethodException expected) {
assertTrue(true);
}
}