From bc847f564f0f0006c27a6da2a063a438cd9d3e20 Mon Sep 17 00:00:00 2001 From: Ben Alex Date: Sun, 28 Mar 2004 11:31:22 +0000 Subject: [PATCH] Expanded unit test coverage. --- .../acegisecurity/GrantedAuthorityImplTests.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/core/src/test/java/org/acegisecurity/GrantedAuthorityImplTests.java b/core/src/test/java/org/acegisecurity/GrantedAuthorityImplTests.java index cb27b6fc32..df905f2847 100644 --- a/core/src/test/java/org/acegisecurity/GrantedAuthorityImplTests.java +++ b/core/src/test/java/org/acegisecurity/GrantedAuthorityImplTests.java @@ -19,7 +19,7 @@ import junit.framework.TestCase; /** - * Tests {@link GrantedAuthorityImpl} + * Tests {@link GrantedAuthorityImpl}. * * @author Ben Alex * @version $Id$ @@ -45,6 +45,15 @@ public class GrantedAuthorityImplTests extends TestCase { junit.textui.TestRunner.run(GrantedAuthorityImplTests.class); } + public void testNoArgsConstructor() { + try { + new GrantedAuthorityImpl(); + fail("Should have thrown IllegalArgumentException"); + } catch (IllegalArgumentException expected) { + assertTrue(true); + } + } + public void testObjectEquals() throws Exception { GrantedAuthorityImpl auth1 = new GrantedAuthorityImpl("TEST"); GrantedAuthorityImpl auth2 = new GrantedAuthorityImpl("TEST"); @@ -70,6 +79,11 @@ public class GrantedAuthorityImplTests extends TestCase { assertTrue(!auth1.equals(int1)); } + public void testToString() { + GrantedAuthorityImpl auth = new GrantedAuthorityImpl("TEST"); + assertEquals("TEST", auth.toString()); + } + //~ Inner Classes ========================================================== private class MockGrantedAuthorityImpl implements GrantedAuthority {