Bump upstreams for 2022.09 Chlorine
[openflowplugin.git] / extension / openflowjava-extension-nicira / src / test / java / org / opendaylight / openflowjava / nx / codec / match / IcmpTypeCodecTest.java
index 9ac0781b0ac83e6b8fee6707d4743d6560acd23d..9e22860f1537081fc89878415f8a1c0fe7c6d62f 100644 (file)
@@ -11,32 +11,26 @@ import static org.junit.Assert.assertEquals;
 
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.ByteBufAllocator;
-import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfIcmpType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.aug.nx.match.IcmpTypeCaseValue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.aug.nx.match.IcmpTypeCaseValueBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.icmp.type.grouping.IcmpTypeValuesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.IcmpTypeCaseValue;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.IcmpTypeCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint8;
 
 public class IcmpTypeCodecTest {
+    private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer();
+    private final IcmpTypeCodec icmpTypeCodec = new IcmpTypeCodec();
 
-    IcmpTypeCodec icmpTypeCodec;
-    ByteBuf buffer;
-    MatchEntry input;
+    private MatchEntry input;
 
     private static final int VALUE_LENGTH = 1;
     private static final int NXM_FIELD_CODE = 13;
 
-    @Before
-    public void setUp() {
-        icmpTypeCodec = new IcmpTypeCodec();
-        buffer = ByteBufAllocator.DEFAULT.buffer();
-    }
-
     @Test
     public void serializeTest() {
         input = createMatchEntry();
@@ -58,9 +52,9 @@ public class IcmpTypeCodecTest {
 
         final IcmpTypeCaseValue result = (IcmpTypeCaseValue) input.getMatchEntryValue();
 
-        assertEquals(Nxm0Class.class, input.getOxmClass());
-        assertEquals(NxmOfIcmpType.class, input.getOxmMatchField());
-        assertEquals(false, input.isHasMask());
+        assertEquals(Nxm0Class.VALUE, input.getOxmClass());
+        assertEquals(NxmOfIcmpType.VALUE, input.getOxmMatchField());
+        assertEquals(false, input.getHasMask());
         assertEquals(2, result.getIcmpTypeValues().getValue().shortValue());
     }
 
@@ -69,18 +63,18 @@ public class IcmpTypeCodecTest {
         final IcmpTypeCaseValueBuilder caseBuilder = new IcmpTypeCaseValueBuilder();
         final IcmpTypeValuesBuilder valuesBuilder = new IcmpTypeValuesBuilder();
 
-        matchEntryBuilder.setOxmClass(Nxm0Class.class);
-        matchEntryBuilder.setOxmMatchField(NxmOfIcmpType.class);
+        matchEntryBuilder.setOxmClass(Nxm0Class.VALUE);
+        matchEntryBuilder.setOxmMatchField(NxmOfIcmpType.VALUE);
         matchEntryBuilder.setHasMask(false);
 
-        valuesBuilder.setValue((short)1);
+        valuesBuilder.setValue(Uint8.ONE);
 
         caseBuilder.setIcmpTypeValues(valuesBuilder.build());
         matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
         return matchEntryBuilder.build();
     }
 
-    private static void createBuffer(ByteBuf message) {
+    private static void createBuffer(final ByteBuf message) {
         message.writeShort(OxmMatchConstants.NXM_0_CLASS);
 
         int fieldMask = NXM_FIELD_CODE << 1;