Removed no-arg constructor from UsernamePasswordAuthenticationToken.
This commit is contained in:
parent
c378779610
commit
8f725f7a74
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue