Fix to properly encode several MASKED criterion into JSON.

Change-Id: I6a3b16c3382d60275de0fc0c61087e79038e5ebb
(cherry picked from commit e3c605e3cf137532af81f51f435cc5f2d81cedf5)
diff --git a/core/common/src/test/java/org/onosproject/codec/impl/CriterionCodecTest.java b/core/common/src/test/java/org/onosproject/codec/impl/CriterionCodecTest.java
index f2fd5e5..1542f0d 100644
--- a/core/common/src/test/java/org/onosproject/codec/impl/CriterionCodecTest.java
+++ b/core/common/src/test/java/org/onosproject/codec/impl/CriterionCodecTest.java
@@ -74,6 +74,7 @@
     final MacAddress mcastMac = MacAddress.valueOf("01:00:5E:00:00:01");
     final MacAddress mcastMacMask = MacAddress.valueOf("FF:FF:FF:80:00:00");
     final TpPort tpPort = TpPort.tpPort(40000);
+    final TpPort tpPortMask = TpPort.tpPort(65472);
     final int tributaryPortNumber = 11;
     final int tributarySlotLen = 80;
     final byte[] tributarySlotBitmap = new byte[] {1, 2, 3, 4, 2, 3, 4, 2, 3, 4};
@@ -169,6 +170,16 @@
     }
 
     /**
+     * Tests masked ethernet source criterion (Criterion.Type.ETH_SRC_MASKED).
+     */
+    @Test
+    public void matchEthSrcMaskTest() {
+        Criterion criterion = Criteria.matchEthSrcMasked(mcastMac, mcastMacMask);
+        ObjectNode result = criterionCodec.encode(criterion, context);
+        assertThat(result, matchesCriterion(criterion));
+    }
+
+    /**
      * Tests ethernet type criterion.
      */
     @Test
@@ -259,6 +270,16 @@
     }
 
     /**
+     * Tests source TCP port masked criterion.
+     */
+    @Test
+    public void matchTcpSrcMaskedTest() {
+        Criterion criterion = Criteria.matchTcpSrcMasked(tpPort, tpPortMask);
+        ObjectNode result = criterionCodec.encode(criterion, context);
+        assertThat(result, matchesCriterion(criterion));
+    }
+
+    /**
      * Tests destination TCP port criterion.
      */
     @Test
@@ -269,6 +290,16 @@
     }
 
     /**
+     * Tests destination TCP port masked criterion.
+     */
+    @Test
+    public void matchTcpDstMaskedTest() {
+        Criterion criterion = Criteria.matchTcpDstMasked(tpPort, tpPortMask);
+        ObjectNode result = criterionCodec.encode(criterion, context);
+        assertThat(result, matchesCriterion(criterion));
+    }
+
+    /**
      * Tests source UDP port criterion.
      */
     @Test
@@ -279,6 +310,16 @@
     }
 
     /**
+     * Tests source UDP port masked criterion.
+     */
+    @Test
+    public void matchUdpSrcMaskedTest() {
+        Criterion criterion = Criteria.matchUdpSrcMasked(tpPort, tpPortMask);
+        ObjectNode result = criterionCodec.encode(criterion, context);
+        assertThat(result, matchesCriterion(criterion));
+    }
+
+    /**
      * Tests destination UDP criterion.
      */
     @Test
@@ -289,6 +330,16 @@
     }
 
     /**
+     * Tests destination UDP port masked criterion.
+     */
+    @Test
+    public void matchUdpDstMaskedTest() {
+        Criterion criterion = Criteria.matchUdpDstMasked(tpPort, tpPortMask);
+        ObjectNode result = criterionCodec.encode(criterion, context);
+        assertThat(result, matchesCriterion(criterion));
+    }
+
+    /**
      * Tests source SCTP criterion.
      */
     @Test
@@ -299,6 +350,16 @@
     }
 
     /**
+     * Tests source SCTP port masked criterion.
+     */
+    @Test
+    public void matchSctpSrcMaskedTest() {
+        Criterion criterion = Criteria.matchSctpSrcMasked(tpPort, tpPortMask);
+        ObjectNode result = criterionCodec.encode(criterion, context);
+        assertThat(result, matchesCriterion(criterion));
+    }
+
+    /**
      * Tests destination SCTP criterion.
      */
     @Test
@@ -309,6 +370,16 @@
     }
 
     /**
+     * Tests destination SCTP port masked criterion.
+     */
+    @Test
+    public void matchSctpDstMaskedTest() {
+        Criterion criterion = Criteria.matchSctpDstMasked(tpPort, tpPortMask);
+        ObjectNode result = criterionCodec.encode(criterion, context);
+        assertThat(result, matchesCriterion(criterion));
+    }
+
+    /**
      * Tests ICMP type criterion.
      */
     @Test