001/**
002 * Copyright 2005-2016 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.kew.useroptions;
017
018import org.junit.Test;
019
020import static org.junit.Assert.*;
021
022/**
023 * Unit test for {@link UserOptionsId}
024 *
025 * @author Kuali Rice Team (rice.collab@kuali.org)
026 */
027public class UserOptionsIdTest {
028
029    @Test
030    public void testEquals() throws Exception {
031        UserOptionsId options1 = new UserOptionsId("one", "two");
032        UserOptionsId options2 = new UserOptionsId("two", "one");
033        UserOptionsId options3 = new UserOptionsId("one", "two");
034        UserOptionsId options4 = new UserOptionsId();
035
036        assertFalse(options1.equals(null));
037        assertFalse(options1.equals(options2));
038        assertFalse(options1.equals(options4));
039        assertTrue(options1.equals(options3));
040        assertTrue(options1.equals(options1));
041
042    }
043
044    @Test
045    public void testHashCode() throws Exception {
046        UserOptionsId options1 = new UserOptionsId("one", "two");
047        UserOptionsId options2 = new UserOptionsId("two", "one");
048        UserOptionsId options3 = new UserOptionsId("one", "two");
049        UserOptionsId options4 = new UserOptionsId();
050
051        assertNotEquals(options1.hashCode(), options2.hashCode());
052        assertEquals(options1.hashCode(), options3.hashCode());
053        assertEquals(options4.hashCode(), options4.hashCode());
054
055    }
056}