diff --git a/core/src/main/java/org/springframework/security/core/authority/GrantedAuthorityImpl.java b/core/src/main/java/org/springframework/security/core/authority/GrantedAuthorityImpl.java index 252fb93cf9..aa20c7eccd 100644 --- a/core/src/main/java/org/springframework/security/core/authority/GrantedAuthorityImpl.java +++ b/core/src/main/java/org/springframework/security/core/authority/GrantedAuthorityImpl.java @@ -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; - } } diff --git a/core/src/test/java/org/springframework/security/core/authority/GrantedAuthorityImplTests.java b/core/src/test/java/org/springframework/security/core/authority/GrantedAuthorityImplTests.java index e628e7908a..fb308fa3ca 100644 --- a/core/src/test/java/org/springframework/security/core/authority/GrantedAuthorityImplTests.java +++ b/core/src/test/java/org/springframework/security/core/authority/GrantedAuthorityImplTests.java @@ -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; }