OPNFLWPLUG-1032: Neon-MRI: Bump odlparent, yangtools, mdsal
[openflowplugin.git] / extension / openflowplugin-extension-onf / src / test / java / org / opendaylight / openflowplugin / extension / onf / serializer / BundleControlFactoryTest.java
index 8f3444bb08c0905a3258c37171008f40b260f359..15210b600bad5dd040467147fbf99a27d08433db 100644 (file)
@@ -8,6 +8,8 @@
 
 package org.opendaylight.openflowplugin.extension.onf.serializer;
 
+import static org.mockito.ArgumentMatchers.any;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.UnpooledByteBufAllocator;
 import java.util.ArrayList;
@@ -15,12 +17,10 @@ import java.util.Collections;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.mockito.Matchers;
 import org.mockito.Mockito;
 import org.mockito.runners.MockitoJUnitRunner;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
 import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;
-import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
 import org.opendaylight.openflowplugin.extension.onf.BundleTestUtils;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.BundleControlType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.BundleFlags;
@@ -55,9 +55,9 @@ public class BundleControlFactoryTest extends AbstractBundleMessageFactoryTest {
         dataBuilder.setFlags(new BundleFlags(true, true));
 
         if (withProperty) {
-            dataBuilder.setBundleProperty((new ArrayList<>(Collections.singleton(
-                    BundleTestUtils.createExperimenterProperty(propertyExperimenterData)))));
-            Mockito.when(registry.getSerializer(Matchers.any(MessageTypeKey.class))).thenReturn(propertySerializer);
+            dataBuilder.setBundleProperty(new ArrayList<>(Collections.singleton(
+                    BundleTestUtils.createExperimenterProperty(propertyExperimenterData))));
+            Mockito.when(registry.getSerializer(any())).thenReturn(propertySerializer);
             ((SerializerRegistryInjector) factory).injectSerializerRegistry(registry);
         }
 
@@ -68,8 +68,9 @@ public class BundleControlFactoryTest extends AbstractBundleMessageFactoryTest {
         Assert.assertEquals("Wrong type", BundleControlType.ONFBCTOPENREQUEST.getIntValue(), out.readUnsignedShort());
         Assert.assertEquals("Wrong flags", 3, out.readUnsignedShort());
         if (withProperty) {
-            Assert.assertEquals("Wrong property type", BundlePropertyType.ONFETBPTEXPERIMENTER.getIntValue(), out.readUnsignedShort());
-            int length = out.readUnsignedShort();
+            Assert.assertEquals("Wrong property type", BundlePropertyType.ONFETBPTEXPERIMENTER.getIntValue(),
+                    out.readUnsignedShort());
+            out.readUnsignedShort(); // length
             Assert.assertEquals("Wrong experimenter ID", 1, out.readUnsignedInt());
             Assert.assertEquals("Wrong experimenter type", 2, out.readUnsignedInt());
             Mockito.verify(propertySerializer, Mockito.times(1)).serialize(propertyExperimenterData, out);
@@ -78,5 +79,4 @@ public class BundleControlFactoryTest extends AbstractBundleMessageFactoryTest {
             Assert.assertTrue("Unexpected data", out.readableBytes() == 0);
         }
     }
-
-}
\ No newline at end of file
+}