1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.useroptions;
17
18 import org.junit.Test;
19
20 import static org.junit.Assert.*;
21
22
23
24
25
26
27 public class UserOptionsIdTest {
28
29 @Test
30 public void testEquals() throws Exception {
31 UserOptionsId options1 = new UserOptionsId("one", "two");
32 UserOptionsId options2 = new UserOptionsId("two", "one");
33 UserOptionsId options3 = new UserOptionsId("one", "two");
34 UserOptionsId options4 = new UserOptionsId();
35
36 assertFalse(options1.equals(null));
37 assertFalse(options1.equals(options2));
38 assertFalse(options1.equals(options4));
39 assertTrue(options1.equals(options3));
40 assertTrue(options1.equals(options1));
41
42 }
43
44 @Test
45 public void testHashCode() throws Exception {
46 UserOptionsId options1 = new UserOptionsId("one", "two");
47 UserOptionsId options2 = new UserOptionsId("two", "one");
48 UserOptionsId options3 = new UserOptionsId("one", "two");
49 UserOptionsId options4 = new UserOptionsId();
50
51 assertNotEquals(options1.hashCode(), options2.hashCode());
52 assertEquals(options1.hashCode(), options3.hashCode());
53 assertEquals(options4.hashCode(), options4.hashCode());
54
55 }
56 }