Bump upstreams for 2022.09 Chlorine
[openflowplugin.git] / openflowjava / openflow-protocol-api / src / test / java / org / opendaylight / openflowjava / protocol / api / keys / ActionSerializerKeyTest.java
index 376394a2f4ce03180b0a200bbc4ddc72dfe184ea..6b8d5fedb0e7c2867c3d841f3e10b567302801b3 100644 (file)
@@ -5,7 +5,6 @@
  * 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.protocol.api.keys;
 
 import org.junit.Assert;
@@ -21,6 +20,8 @@ import org.opendaylight.yangtools.yang.common.Uint32;
  * @author michal.polkorab
  */
 public class ActionSerializerKeyTest {
+    private static final Uint32 FORTY_TWO = Uint32.valueOf(42);
+    private static final Uint32 FIFTY_FIVE = Uint32.valueOf(55);
 
     /**
      * Test ActionSerializerKey equals and hashCode.
@@ -28,24 +29,24 @@ public class ActionSerializerKeyTest {
     @Test
     public void test() {
         ActionSerializerKey<CopyTtlInCase> key1 =
-                new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlInCase.class, 42L);
+                new ActionSerializerKey<>(EncodeConstants.OF_VERSION_1_0, CopyTtlInCase.class, FORTY_TWO);
         ActionSerializerKey<?> key2 =
-                new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlInCase.class, 42L);
+                new ActionSerializerKey<>(EncodeConstants.OF_VERSION_1_0, CopyTtlInCase.class, FORTY_TWO);
         Assert.assertTrue("Wrong equals", key1.equals(key2));
         Assert.assertTrue("Wrong hashCode", key1.hashCode() == key2.hashCode());
-        key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlInCase.class, (Uint32) null);
+        key2 = new ActionSerializerKey<>(EncodeConstants.OF_VERSION_1_0, CopyTtlInCase.class, (Uint32) null);
         Assert.assertFalse("Wrong equals", key1.equals(key2));
         Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
-        key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, (Uint32) null);
+        key2 = new ActionSerializerKey<>(EncodeConstants.OF_VERSION_1_0, null, (Uint32) null);
         Assert.assertFalse("Wrong equals", key1.equals(key2));
         Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
-        key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlOutCase.class, 42L);
+        key2 = new ActionSerializerKey<>(EncodeConstants.OF_VERSION_1_0, CopyTtlOutCase.class, FORTY_TWO);
         Assert.assertFalse("Wrong equals", key1.equals(key2));
         Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
-        key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlInCase.class, 55L);
+        key2 = new ActionSerializerKey<>(EncodeConstants.OF_VERSION_1_0, CopyTtlInCase.class, FIFTY_FIVE);
         Assert.assertFalse("Wrong equals", key1.equals(key2));
         Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
-        key2 = new ActionSerializerKey<>(EncodeConstants.OF13_VERSION_ID, CopyTtlInCase.class, 55L);
+        key2 = new ActionSerializerKey<>(EncodeConstants.OF_VERSION_1_3, CopyTtlInCase.class, FIFTY_FIVE);
         Assert.assertFalse("Wrong equals", key1.equals(key2));
         Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
     }
@@ -55,18 +56,18 @@ public class ActionSerializerKeyTest {
      */
     @Test
     public void testEquals() {
-        ActionSerializerKey<?> key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);
-        ActionSerializerKey<?> key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
-                CopyTtlInCase.class, 42L);
+        ActionSerializerKey<?> key1 = new ActionSerializerKey<>(EncodeConstants.OF_VERSION_1_0, null, FORTY_TWO);
+        ActionSerializerKey<?> key2 = new ActionSerializerKey<>(EncodeConstants.OF_VERSION_1_0,
+                CopyTtlInCase.class, FORTY_TWO);
 
         Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
         Assert.assertFalse("Wrong equal by actionType", key1.equals(key2));
 
-        key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);
+        key2 = new ActionSerializerKey<>(EncodeConstants.OF_VERSION_1_0, null, FORTY_TWO);
         Assert.assertTrue("Wrong equal by action type", key1.equals(key2));
-        key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID,  CopyTtlInCase.class, (Uint32) null);
+        key1 = new ActionSerializerKey<>(EncodeConstants.OF_VERSION_1_0,  CopyTtlInCase.class, (Uint32) null);
         Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));
-        key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlInCase.class, (Uint32) null);
+        key2 = new ActionSerializerKey<>(EncodeConstants.OF_VERSION_1_0, CopyTtlInCase.class, (Uint32) null);
         Assert.assertTrue("Wrong equal by experimenterId", key1.equals(key2));
     }
 
@@ -75,8 +76,8 @@ public class ActionSerializerKeyTest {
      */
     @Test
     public void testToString() {
-        ActionSerializerKey<CopyTtlInCase> key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
-                CopyTtlInCase.class, 42L);
+        ActionSerializerKey<CopyTtlInCase> key1 = new ActionSerializerKey<>(EncodeConstants.OF_VERSION_1_0,
+                CopyTtlInCase.class, FORTY_TWO);
 
         Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectType: org.opendaylight.yang.gen.v1.urn"
                 + ".opendaylight.openflow.common.action.rev150203.actions.grouping.Action action type:"