Merge "Add INFO.yaml for openflowplugin"
[openflowplugin.git] / extension / openflowjava-extension-nicira / src / test / java / org / opendaylight / openflowjava / nx / codec / action / ActionDeserializerTest.java
index a6285a7d0a88be42f61dab8a528765e48b31506d..0fa709408e2b55a22571ee0a22c9d88d1981abf5 100644 (file)
@@ -1,11 +1,10 @@
-/**
+/*
  * Copyright (c) 2016 Cisco Systems, Inc. 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.openflowjava.nx.codec.action;
 
 import static org.junit.Assert.assertNull;
@@ -19,13 +18,14 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.mockito.Mockito;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
 import org.opendaylight.openflowjava.nx.NiciraExtensionCodecRegistratorImpl;
 import org.opendaylight.openflowjava.nx.api.NiciraActionDeserializerKey;
 import org.opendaylight.openflowjava.nx.api.NiciraConstants;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
 import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 @RunWith(MockitoJUnitRunner.class)
 public class ActionDeserializerTest {
@@ -47,7 +47,7 @@ public class ActionDeserializerTest {
 
 
     private static final short VERSION = 4;
-    private static final long EXPERIMENT_ID = NiciraConstants.NX_VENDOR_ID;
+    private static final Uint32 EXPERIMENT_ID = NiciraConstants.NX_VENDOR_ID;
     private static final byte SUBTYPE = 10;
 
     @Before
@@ -55,14 +55,11 @@ public class ActionDeserializerTest {
         actionDeserializer = new ActionDeserializer(VERSION);
         buffer = ByteBufAllocator.DEFAULT.buffer();
         providers = new LinkedList<>();
-
-
     }
 
-
     /**
      * If NiciraExtensionCodecRegistratorImpl.getActionDeserializer(actionSerializerKey) returns NULL
-     * then NULL should be returned
+     * then NULL should be returned.
      */
     @Test
     public void deserializeTest() {
@@ -71,8 +68,7 @@ public class ActionDeserializerTest {
     }
 
     /**
-     * If experimentId is different from NiciraConstants.NX_VENDOR_ID
-     * then exception should be thrown
+     * If experimentId is different from NiciraConstants.NX_VENDOR_ID then exception should be thrown.
      */
     @Test(expected = IllegalStateException.class)
     public void deserializeTest1() {
@@ -90,18 +86,18 @@ public class ActionDeserializerTest {
         Mockito.verify(deserializer).deserialize(buffer);
     }
 
-    private void createBuffer(ByteBuf message) {
+    private static void createBuffer(ByteBuf message) {
         //size of experiment type
         message.writeShort(1);
         //size of length
         message.writeShort(13);
         //experimentId
-        message.writeInt((int)EXPERIMENT_ID);
+        message.writeInt(EXPERIMENT_ID.intValue());
         //subtype
         message.writeShort(SUBTYPE);
     }
 
-    private void createBufferWithWrongExperimentId(ByteBuf message) {
+    private static void createBufferWithWrongExperimentId(ByteBuf message) {
         //size of experiment type
         message.writeShort(1);
         //size of length
@@ -119,4 +115,4 @@ public class ActionDeserializerTest {
         niciraExtensionCodecRegistrator.registerActionDeserializer(key, deserializer);
     }
 
-}
\ No newline at end of file
+}