diff --git a/core/src/main/java/org/acegisecurity/GrantedAuthorityImpl.java b/core/src/main/java/org/acegisecurity/GrantedAuthorityImpl.java index d936a28832..171154ca5e 100644 --- a/core/src/main/java/org/acegisecurity/GrantedAuthorityImpl.java +++ b/core/src/main/java/org/acegisecurity/GrantedAuthorityImpl.java @@ -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(); } diff --git a/core/src/test/java/org/acegisecurity/GrantedAuthorityImplTests.java b/core/src/test/java/org/acegisecurity/GrantedAuthorityImplTests.java index 1571e00816..f374f87b28 100644 --- a/core/src/test/java/org/acegisecurity/GrantedAuthorityImplTests.java +++ b/core/src/test/java/org/acegisecurity/GrantedAuthorityImplTests.java @@ -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 {