Test composite node with empty conts and lists to Json
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / test / java / org / opendaylight / controller / sal / restconf / impl / test / structures / Lf.java
index 66cf1cc6101807b8a6f86aae7dacbb4541353dad..a1e06c3cabfa1d1cbeb207c676da1583cb4643d2 100644 (file)
@@ -2,6 +2,8 @@ package org.opendaylight.controller.sal.restconf.impl.test.structures;
 
 public class Lf extends YangElement {
     private String value;
+    private int numOfEqualItems = 0;
+
 
     public Lf(String name, String value) {
         super(name);
@@ -29,17 +31,30 @@ public class Lf extends YangElement {
             return false;
         }
         Lf lf = (Lf) obj;
-        if (!this.value.equals(lf.value)) {
+        if (this.value == null) {
+            if (lf.value != null) {
+                return false;
+            }
+        } else if (!this.value.equals(lf.value)) {
+            return false;
+        }
+        if (this.numOfEqualItems != lf.numOfEqualItems) {
             return false;
         }
         return true;
     }
+    
+    public void incNumOfEqualItems() {
+        this.numOfEqualItems++;
+    }
+    
 
     @Override
     public int hashCode() {
         final int prime = 31;
         int result = super.hashCode();
         result = prime * result + ((value == null) ? 0 : value.hashCode());
+        result = prime * result + numOfEqualItems;
         return result;
     }