Migrate openflow-protocol-impl tests to Uint types
[openflowplugin.git] / openflowjava / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / serialization / match / OxmPbbIsidSerializerTest.java
index 3d8db87f6db9e7dc60da9712fb39336a5d8b722e..e2427d5120a76f73a82272a6afd934221ebb18d0 100644 (file)
@@ -10,9 +10,9 @@ package org.opendaylight.openflowjava.protocol.impl.serialization.match;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.PooledByteBufAllocator;
-
 import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
@@ -22,17 +22,19 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.PbbI
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.PbbIsidCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.pbb.isid._case.PbbIsidBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 /**
- * @author michal.polkorab
+ * Unit tests for OxmPbbIsidSerializer.
  *
+ * @author michal.polkorab
  */
 public class OxmPbbIsidSerializerTest {
 
     OxmPbbIsidSerializer serializer = new OxmPbbIsidSerializer();
 
     /**
-     * Test correct serialization
+     * Test correct serialization.
      */
     @Test
     public void testSerializeWithMask() {
@@ -47,7 +49,7 @@ public class OxmPbbIsidSerializerTest {
     }
 
     /**
-     * Test correct serialization
+     * Test correct serialization.
      */
     @Test
     public void testSerializeWithoutMask() {
@@ -65,7 +67,7 @@ public class OxmPbbIsidSerializerTest {
     }
 
     /**
-     * Test correct header serialization
+     * Test correct header serialization.
      */
     @Test
     public void testSerializeHeaderWithoutMask() {
@@ -79,7 +81,7 @@ public class OxmPbbIsidSerializerTest {
     }
 
     /**
-     * Test correct header serialization
+     * Test correct header serialization.
      */
     @Test
     public void testSerializeHeaderWithMask() {
@@ -93,7 +95,7 @@ public class OxmPbbIsidSerializerTest {
     }
 
     /**
-     * Test correct oxm-class return value
+     * Test correct oxm-class return value.
      */
     @Test
     public void testGetOxmClassCode() {
@@ -101,7 +103,7 @@ public class OxmPbbIsidSerializerTest {
     }
 
     /**
-     * Test correct oxm-field return value
+     * Test correct oxm-field return value.
      */
     @Test
     public void getOxmFieldCode() {
@@ -109,21 +111,21 @@ public class OxmPbbIsidSerializerTest {
     }
 
     /**
-     * Test correct value length return value
+     * Test correct value length return value.
      */
     @Test
     public void testGetValueLength() {
         assertEquals("Wrong value length", EncodeConstants.SIZE_OF_3_BYTES, serializer.getValueLength());
     }
 
-    private static MatchEntryBuilder preparePbbIsidMatchEntry(boolean hasMask, long value) {
-        MatchEntryBuilder builder = preparePbbIsidHeader(hasMask);
+    private static MatchEntryBuilder preparePbbIsidMatchEntry(boolean hasMask, int value) {
+        final MatchEntryBuilder builder = preparePbbIsidHeader(hasMask);
         PbbIsidCaseBuilder casebuilder = new PbbIsidCaseBuilder();
         PbbIsidBuilder valueBuilder = new PbbIsidBuilder();
         if (hasMask) {
             valueBuilder.setMask(new byte[]{0, 15, 10});
         }
-        valueBuilder.setIsid(value);
+        valueBuilder.setIsid(Uint32.valueOf(value));
         casebuilder.setPbbIsid(valueBuilder.build());
         builder.setMatchEntryValue(casebuilder.build());
         return builder;
@@ -148,4 +150,4 @@ public class OxmPbbIsidSerializerTest {
             assertEquals("Wrong length", EncodeConstants.SIZE_OF_3_BYTES, buffer.readUnsignedByte());
         }
     }
-}
\ No newline at end of file
+}