2 * Copyright (c) 2015 Inocybe and others. All rights reserved.
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
9 package org.opendaylight.netvirt.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 import static org.mockito.Mockito.mock;
16 import org.junit.Test;
17 import org.junit.runner.RunWith;
18 import org.mockito.InjectMocks;
19 import org.mockito.runners.MockitoJUnitRunner;
20 import org.opendaylight.netvirt.openstack.netvirt.api.Action;
21 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
24 * Unit test for {@link NodeCacheManagerEvent}
27 @RunWith(MockitoJUnitRunner.class)
28 public class NodeCacheManagerEventTest {
30 @InjectMocks private NodeCacheManagerEvent nodeCacheManagerEvent;
33 public void testToString() {
34 Node node = mock(Node.class);
35 nodeCacheManagerEvent = new NodeCacheManagerEvent(node, Action.ADD);
36 assertEquals("Error, toString() did not return the correct string", "NodeCacheManagerEvent [action=ADD, node=" + node + "]", nodeCacheManagerEvent.toString());
40 public void testHashCode() {
41 assertNotNull("Error, hashCode shouldn't be null", nodeCacheManagerEvent.hashCode());
45 public void testEquals() {
46 assertTrue("Error, the two object should be equal", nodeCacheManagerEvent.equals(nodeCacheManagerEvent));
47 assertFalse("Error, the two object should not be equal", nodeCacheManagerEvent.equals("dummy"));