Merge "Add JUnit testing for NodeCacheManagerEvent class."
[ovsdb.git] / openstack / net-virt / src / test / java / org / opendaylight / ovsdb / openstack / netvirt / NodeCacheManagerEventTest.java
1 /*
2  * Copyright (c) 2015 Inocybe and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.ovsdb.openstack.netvirt;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertFalse;
12 import static org.junit.Assert.assertNotNull;
13 import static org.junit.Assert.assertTrue;
14
15 import org.junit.Before;
16 import org.junit.Test;
17 import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
18
19 /**
20  * Unit test for {@link NodeCacheManagerEvent}
21  */
22 public class NodeCacheManagerEventTest {
23
24     private NodeCacheManagerEvent nodeCacheManagerEvent;
25
26     @Before
27     public void setUp() {
28         nodeCacheManagerEvent = new NodeCacheManagerEvent("nodeIdentifier", Action.ADD);
29     }
30
31     @Test
32     public void testToString() {
33         assertEquals("Error, toString() did not return the correct string", "NodeCacheManagerEvent [action=ADD, nodeIdentifier=nodeIdentifier]", nodeCacheManagerEvent.toString());
34     }
35
36     @Test
37     public void testHashCode() {
38         assertNotNull("Error, hashCode shouldn't be null", nodeCacheManagerEvent.hashCode());
39     }
40
41     @Test
42     public void testEquals() {
43         assertTrue("Error, the two object should be equal", nodeCacheManagerEvent.equals(nodeCacheManagerEvent));
44         assertFalse("Error, the two object should not be equal", nodeCacheManagerEvent.equals(new String("dummy")));
45     }
46 }