Add JUnit testing for NodeCacheManagerEvent class. 46/18046/1
authorAlexis de Talhouët <adetalhouet@inocybe.com>
Thu, 9 Apr 2015 15:51:28 +0000 (11:51 -0400)
committerAlexis de Talhouët <adetalhouet@inocybe.com>
Thu, 9 Apr 2015 15:51:28 +0000 (11:51 -0400)
Change-Id: I1f360c2c997a72420566d75684e7ef81b18e14ac
Signed-off-by: Alexis de Talhouët <adetalhouet@inocybe.com>
openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/NodeCacheManagerEventTest.java [new file with mode: 0644]

diff --git a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/NodeCacheManagerEventTest.java b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/NodeCacheManagerEventTest.java
new file mode 100644 (file)
index 0000000..5765a75
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2015 Inocybe and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.ovsdb.openstack.netvirt;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
+
+/**
+ * Unit test for {@link NodeCacheManagerEvent}
+ */
+public class NodeCacheManagerEventTest {
+
+    private NodeCacheManagerEvent nodeCacheManagerEvent;
+
+    @Before
+    public void setUp() {
+        nodeCacheManagerEvent = new NodeCacheManagerEvent("nodeIdentifier", Action.ADD);
+    }
+
+    @Test
+    public void testToString() {
+        assertEquals("Error, toString() did not return the correct string", "NodeCacheManagerEvent [action=ADD, nodeIdentifier=nodeIdentifier]", nodeCacheManagerEvent.toString());
+    }
+
+    @Test
+    public void testHashCode() {
+        assertNotNull("Error, hashCode shouldn't be null", nodeCacheManagerEvent.hashCode());
+    }
+
+    @Test
+    public void testEquals() {
+        assertTrue("Error, the two object should be equal", nodeCacheManagerEvent.equals(nodeCacheManagerEvent));
+        assertFalse("Error, the two object should not be equal", nodeCacheManagerEvent.equals(new String("dummy")));
+    }
+}