SEC-123: Remove exception from no-arg constructor.
This commit is contained in:
parent
ea182f73fe
commit
82be52cea0
|
@ -1,4 +1,4 @@
|
|||
/* Copyright 2004 Acegi Technology Pty Limited
|
||||
/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -41,16 +41,8 @@ public class GrantedAuthorityImpl implements GrantedAuthority, Serializable {
|
|||
this.role = role;
|
||||
}
|
||||
|
||||
protected GrantedAuthorityImpl() {
|
||||
throw new IllegalArgumentException("Cannot use default constructor");
|
||||
}
|
||||
|
||||
//~ Methods ================================================================
|
||||
|
||||
public String getAuthority() {
|
||||
return this.role;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof String) {
|
||||
return obj.equals(this.role);
|
||||
|
@ -65,6 +57,10 @@ public class GrantedAuthorityImpl implements GrantedAuthority, Serializable {
|
|||
return false;
|
||||
}
|
||||
|
||||
public String getAuthority() {
|
||||
return this.role;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return this.role.hashCode();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright 2004 Acegi Technology Pty Limited
|
||||
/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -37,21 +37,12 @@ public class GrantedAuthorityImplTests extends TestCase {
|
|||
|
||||
//~ Methods ================================================================
|
||||
|
||||
public final void setUp() throws Exception {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
junit.textui.TestRunner.run(GrantedAuthorityImplTests.class);
|
||||
}
|
||||
|
||||
public void testNoArgsConstructor() {
|
||||
try {
|
||||
new GrantedAuthorityImpl();
|
||||
fail("Should have thrown IllegalArgumentException");
|
||||
} catch (IllegalArgumentException expected) {
|
||||
assertTrue(true);
|
||||
}
|
||||
public final void setUp() throws Exception {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
public void testObjectEquals() throws Exception {
|
||||
|
|
Loading…
Reference in New Issue