1
0
mirror of synced 2026-08-05 17:57:15 +00:00

SEC-1304: Removed compareTo method from GrantedAuthorityImpl

This method had been left by mistake when the Comparable 
interface was removed. See also SEC-1347.
This commit is contained in:
Luke Taylor
2010-01-04 19:13:49 +00:00
parent c6b8fe5e55
commit 93973a4b75
2 changed files with 0 additions and 32 deletions
@@ -32,7 +32,6 @@ import org.springframework.util.Assert;
* method will return -1, so the custom authority will take precedence.
*
* @author Ben Alex
* @version $Id$
*/
public class GrantedAuthorityImpl implements GrantedAuthority, Serializable {
//~ Instance fields ================================================================================================
@@ -74,17 +73,4 @@ public class GrantedAuthorityImpl implements GrantedAuthority, Serializable {
public String toString() {
return this.role;
}
public int compareTo(GrantedAuthority ga) {
if (ga != null) {
String rhsRole = ga.getAuthority();
if (rhsRole == null) {
return -1;
}
return role.compareTo(rhsRole);
}
return -1;
}
}
@@ -61,30 +61,12 @@ public class GrantedAuthorityImplTests {
assertEquals("TEST", auth.toString());
}
@Test
public void compareToGrantedAuthorityWithSameValueReturns0() {
assertEquals(0, new GrantedAuthorityImpl("TEST").compareTo(new MockGrantedAuthority("TEST")));
}
@Test
public void compareToNullReturnsNegativeOne() {
assertEquals(-1, new GrantedAuthorityImpl("TEST").compareTo(null));
}
/* SEC-899 */
@Test
public void compareToHandlesCustomAuthorityWhichReturnsNullFromGetAuthority() {
assertEquals(-1, new GrantedAuthorityImpl("TEST").compareTo(new MockGrantedAuthority()));
}
//~ Inner Classes ==================================================================================================
private class MockGrantedAuthority implements GrantedAuthority {
private String role;
public MockGrantedAuthority() {
}
public MockGrantedAuthority(String role) {
this.role = role;
}