adding support of WCMP weights to Next Objective

Change-Id: Id8f9a4222d0d9d98995f727dbfbf467ab2104468
diff --git a/core/common/src/test/java/org/onosproject/codec/impl/NextObjectiveJsonMatcher.java b/core/common/src/test/java/org/onosproject/codec/impl/NextObjectiveJsonMatcher.java
index bb86771..cdf4da9 100644
--- a/core/common/src/test/java/org/onosproject/codec/impl/NextObjectiveJsonMatcher.java
+++ b/core/common/src/test/java/org/onosproject/codec/impl/NextObjectiveJsonMatcher.java
@@ -16,9 +16,13 @@
 package org.onosproject.codec.impl;
 
 import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.hamcrest.Description;
 import org.hamcrest.TypeSafeDiagnosingMatcher;
 import org.onosproject.net.flowobjective.NextObjective;
+import org.onosproject.net.flowobjective.NextTreatment;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * Hamcrest matcher for nextObjective.
@@ -58,6 +62,22 @@
             return false;
         }
 
+        // check the weight
+        boolean result = true;
+        List<NextTreatment> nt = new ArrayList(nextObjective.nextTreatments());
+        for (int i = 0; i < jsonTreatments.size(); i++) {
+            ObjectNode jsonTreatment = jsonTreatments.path(i).isObject() &&
+                    !jsonTreatments.path(i).isNull() ? (ObjectNode) jsonTreatments.path(i) : null;
+            int jsonWeight = jsonTreatment.get("weight").asInt();
+            if (jsonWeight != nt.get(i).weight()) {
+                description.appendText("weight of NextTreatment with index " + i + " was " + jsonWeight);
+                result = false;
+            }
+        }
+        if (!result) {
+            return false;
+        }
+
         // TODO: need to check the content of treatment collection
 
         // TODO: need to check the content of selector instance