Bump mdsal to 5.0.2
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / statistics / services / compatibility / AbstractCompatibleStatServiceTest.java
index 8d6092cdc6ea816c7b9edee32b250fcc21bbe67b..92423c7896f80de4aad91f668fa1bf4eceb8c938 100644 (file)
@@ -8,6 +8,9 @@
 
 package org.opendaylight.openflowplugin.impl.statistics.services.compatibility;
 
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.ListenableFuture;
 import java.math.BigInteger;
@@ -17,11 +20,10 @@ import org.junit.Assert;
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
 import org.mockito.Captor;
-import org.mockito.Matchers;
 import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.stubbing.Answer;
-import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.mdsal.binding.api.NotificationPublishService;
 import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
@@ -50,6 +52,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint8;
 
 /**
  * Test for {@link AbstractCompatibleStatService}.
@@ -79,7 +83,7 @@ public class AbstractCompatibleStatServiceTest extends AbstractStatsServiceTest
 
     @Override
     public void setUp() {
-        rqContext = new AbstractRequestContext<Object>(42L) {
+        rqContext = new AbstractRequestContext<>(Uint32.valueOf(42)) {
             @Override
             public void close() {
                 //NOOP
@@ -91,26 +95,26 @@ public class AbstractCompatibleStatServiceTest extends AbstractStatsServiceTest
             return null;
         };
 
-        Mockito.when(featuresOutput.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
-        Mockito.when(rqContextStack.<Object>createRequestContext()).thenReturn(rqContext);
-        Mockito.when(deviceContext.getDeviceState()).thenReturn(deviceState);
+        Mockito.lenient().when(featuresOutput.getVersion()).thenReturn(Uint8.valueOf(OFConstants.OFP_VERSION_1_3));
+        Mockito.when(rqContextStack.createRequestContext()).thenReturn(rqContext);
+        Mockito.lenient().when(deviceContext.getDeviceState()).thenReturn(deviceState);
         Mockito.when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo);
         Mockito.when(deviceInfo.getNodeId()).thenReturn(NODE_ID);
         Mockito.when(deviceInfo.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
         Mockito.doAnswer(closeRequestFutureAnswer).when(multiMsgCollector).endCollecting(null);
-        Mockito.doAnswer(closeRequestFutureAnswer).when(multiMsgCollector)
-                .endCollecting(Matchers.any(EventIdentifier.class));
+        Mockito.lenient().doAnswer(closeRequestFutureAnswer).when(multiMsgCollector)
+                .endCollecting(any(EventIdentifier.class));
 
         Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider)
-                .commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class));
+                .commitEntry(eq(42L), requestInput.capture(), any(FutureCallback.class));
 
-        Mockito.when(translatorLibrary.lookupTranslator(Matchers.any(TranslatorKey.class))).thenReturn(translator);
+        Mockito.when(translatorLibrary.lookupTranslator(any(TranslatorKey.class))).thenReturn(translator);
 
         service = AggregateFlowsInTableService.createWithOook(rqContextStack, deviceContext, new AtomicLong(20L));
     }
 
     @Test
-    public void testGetOfVersion() throws Exception {
+    public void testGetOfVersion() {
         Assert.assertEquals(OFConstants.OFP_VERSION_1_3, service.getOfVersion().getVersion());
     }
 
@@ -140,7 +144,7 @@ public class AbstractCompatibleStatServiceTest extends AbstractStatsServiceTest
                 .setFlowCount(new Counter32(12L))
                 .setPacketCount(new Counter64(BigInteger.valueOf(13L)))
                 .build();
-        Mockito.when(translator.translate(Matchers.any(MultipartReply.class), Matchers.eq(deviceInfo), Matchers.any()))
+        Mockito.when(translator.translate(any(MultipartReply.class), eq(deviceInfo), any()))
                 .thenReturn(aggregatedStats);
 
 
@@ -152,6 +156,6 @@ public class AbstractCompatibleStatServiceTest extends AbstractStatsServiceTest
         Assert.assertTrue(result.isSuccessful());
         Assert.assertEquals(MultipartType.OFPMPAGGREGATE, requestInput.getValue().getType());
         Mockito.verify(notificationPublishService, Mockito.timeout(500))
-                .offerNotification(Matchers.any(AggregateFlowStatisticsUpdate.class));
+                .offerNotification(any(AggregateFlowStatisticsUpdate.class));
     }
 }