01: /*
02: * BasicPrincipalTest.java
03: * JUnit based test
04: *
05: * Created on June 20, 2007, 6:45 AM
06: */
07:
08: package com.rift.coad.security;
09:
10: import junit.framework.*;
11: import java.security.Principal;
12: import java.io.Serializable;
13:
14: /**
15: *
16: * @author brett
17: */
18: public class BasicPrincipalTest extends TestCase {
19:
20: public BasicPrincipalTest(String testName) {
21: super (testName);
22: }
23:
24: protected void setUp() throws Exception {
25: }
26:
27: protected void tearDown() throws Exception {
28: }
29:
30: /**
31: * Test of getName method, of class com.rift.coad.security.BasicPrincipal.
32: */
33: public void testGetName() {
34: System.out.println("getName");
35:
36: BasicPrincipal instance = new BasicPrincipal("test");
37:
38: String expResult = "test";
39: String result = instance.getName();
40: assertEquals(expResult, result);
41:
42: }
43:
44: /**
45: * Test of equals method, of class com.rift.coad.security.BasicPrincipal.
46: */
47: public void testEquals() {
48: System.out.println("equals");
49:
50: Object value = new BasicPrincipal("test");
51: BasicPrincipal instance = new BasicPrincipal("test");
52:
53: boolean expResult = true;
54: boolean result = instance.equals(value);
55: assertEquals(expResult, result);
56:
57: }
58:
59: /**
60: * Test of hashCode method, of class com.rift.coad.security.BasicPrincipal.
61: */
62: public void testHashCode() {
63: System.out.println("hashCode");
64:
65: BasicPrincipal instance = new BasicPrincipal(null);
66:
67: int expResult = 0;
68: int result = instance.hashCode();
69: assertEquals(expResult, result);
70:
71: instance = new BasicPrincipal("test");
72: assertEquals(instance.hashCode(), instance.hashCode());
73:
74: }
75:
76: /**
77: * Test of toString method, of class com.rift.coad.security.BasicPrincipal.
78: */
79: public void testToString() {
80: System.out.println("toString");
81:
82: BasicPrincipal instance = new BasicPrincipal("test");
83:
84: String expResult = "test";
85: String result = instance.toString();
86: assertEquals(expResult, result);
87:
88: }
89:
90: }
|