OPNFLWPLUG-1032: Neon-MRI: Bump odlparent, yangtools, mdsal
[openflowplugin.git] / applications / notification-supplier / src / test / java / org / opendaylight / openflowplugin / applications / notification / supplier / impl / NodeNotificationSupplierImplTest.java
index 4ea49086832ceaf9d0d0c9c9b203ebcc0f66703c..1b3e2665f1746b7a85566e42086b80cfad07e90f 100644 (file)
@@ -10,20 +10,15 @@ package org.opendaylight.openflowplugin.applications.notification.supplier.impl;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
 import org.junit.Before;
 import org.junit.Test;
-import org.mockito.Matchers;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
@@ -31,22 +26,16 @@ import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.openflowplugin.applications.notification.supplier.impl.helper.TestChangeEventBuildHelper;
 import org.opendaylight.openflowplugin.applications.notification.supplier.impl.helper.TestData;
 import org.opendaylight.openflowplugin.applications.notification.supplier.impl.helper.TestSupplierVerifyHelper;
-import org.opendaylight.openflowplugin.applications.notification.supplier.impl.helper.TestSupplierVerifyHelper;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRemoved;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeUpdated;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
-import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
-/**
- *
- */
 public class NodeNotificationSupplierImplTest {
 
     private static final String FLOW_NODE_ID = "openflow:111";
@@ -59,7 +48,7 @@ public class NodeNotificationSupplierImplTest {
         notifProviderService = mock(NotificationProviderService.class);
         dataBroker = mock(DataBroker.class);
         notifSupplierImpl = new NodeNotificationSupplierImpl(notifProviderService, dataBroker);
-        TestSupplierVerifyHelper.verifyDataChangeRegistration(dataBroker);
+        TestSupplierVerifyHelper.verifyDataTreeChangeListenerRegistration(dataBroker);
     }
 
     @Test(expected = NullPointerException.class)
@@ -69,7 +58,7 @@ public class NodeNotificationSupplierImplTest {
 
     @Test(expected = NullPointerException.class)
     public void testNullableChangeEvent() {
-        notifSupplierImpl.onDataTreeChanged( TestChangeEventBuildHelper.createNullTestDataTreeEvent());
+        notifSupplierImpl.onDataTreeChanged(TestChangeEventBuildHelper.createNullTestDataTreeEvent());
     }
 
     @Test
@@ -79,21 +68,22 @@ public class NodeNotificationSupplierImplTest {
 
     @Test
     public void testCreate() {
-        final NodeUpdated notification = notifSupplierImpl.createNotification(createTestFlowCapableNode(),
-                createTestFlowCapableNodePath());
+        final NodeUpdated notification = notifSupplierImpl
+                .createNotification(createTestFlowCapableNode(), createTestFlowCapableNodePath());
         assertNotNull(notification);
         assertEquals(FLOW_NODE_ID, notification.getId().getValue());
-        assertEquals(FLOW_NODE_ID, notification.getNodeRef().getValue().firstKeyOf(Node.class, NodeKey.class).getId().getValue());
+        assertEquals(FLOW_NODE_ID,
+                     notification.getNodeRef().getValue().firstKeyOf(Node.class).getId().getValue());
     }
 
     @Test
     public void testCreateChangeEvent() {
-        final TestData testData = new TestData(createTestFlowCapableNodePath(),null,
-                createTestFlowCapableNode(), DataObjectModification.ModificationType.WRITE);
+        final TestData testData = new TestData(createTestFlowCapableNodePath(), null, createTestFlowCapableNode(),
+                                               DataObjectModification.ModificationType.WRITE);
         Collection<DataTreeModification<FlowCapableNode>> collection = new ArrayList<>();
         collection.add(testData);
         notifSupplierImpl.onDataTreeChanged(collection);
-        verify(notifProviderService, times(1)).publish(Matchers.any(NodeUpdated.class));
+        verify(notifProviderService, times(1)).publish(any(NodeUpdated.class));
     }
 
     @Test(expected = IllegalArgumentException.class)
@@ -110,17 +100,18 @@ public class NodeNotificationSupplierImplTest {
     public void testDelete() {
         final NodeRemoved notification = notifSupplierImpl.deleteNotification(createTestFlowCapableNodePath());
         assertNotNull(notification);
-        assertEquals(FLOW_NODE_ID, notification.getNodeRef().getValue().firstKeyOf(Node.class, NodeKey.class).getId().getValue());
+        assertEquals(FLOW_NODE_ID,
+                     notification.getNodeRef().getValue().firstKeyOf(Node.class).getId().getValue());
     }
 
     @Test
     public void testDeleteChangeEvent() {
-        final TestData testData = new TestData(createTestFlowCapableNodePath(),
-                createTestFlowCapableNode(),null, DataObjectModification.ModificationType.DELETE);
+        final TestData testData = new TestData(createTestFlowCapableNodePath(), createTestFlowCapableNode(), null,
+                                               DataObjectModification.ModificationType.DELETE);
         Collection<DataTreeModification<FlowCapableNode>> collection = new ArrayList<>();
         collection.add(testData);
         notifSupplierImpl.onDataTreeChanged(collection);
-        verify(notifProviderService, times(1)).publish(Matchers.any(NodeRemoved.class));
+        verify(notifProviderService, times(1)).publish(any(NodeRemoved.class));
     }
 
     @Test(expected = IllegalArgumentException.class)