View Javadoc
1   /**
2    * Copyright 2005-2015 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kew.useroptions;
17  
18  import org.junit.Test;
19  
20  import static org.junit.Assert.*;
21  
22  /**
23   * Unit test for {@link UserOptionsId}
24   *
25   * @author Kuali Rice Team (rice.collab@kuali.org)
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  }