Bläddra i källkod

SEC-1304: Removed compareTo method from GrantedAuthorityImpl

This method had been left by mistake when the Comparable 
interface was removed. See also SEC-1347.
Luke Taylor 15 år sedan
förälder
incheckning
93973a4b75

+ 0 - 14
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;
-    }
 }

+ 0 - 18
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;
         }