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 / LfLst.java
index 7688f2ed22bdf3817785cc368d6bd1cf0f0b7a44..87fed95f6ff15b4a2a3800a0adaa25c1aaf62ba0 100644 (file)
@@ -10,8 +10,16 @@ public class LfLst extends YangElement {
         lfs = new HashSet<>();
     }
 
+    public LfLst addLf(String value) {
+        return addLf(new Lf(value));
+    }
+
+    
     public LfLst addLf(Lf lf) {
-        lfs.add(lf);
+        while (this.lfs.contains(lf)) {
+            lf.incNumOfEqualItems();
+        }
+        this.lfs.add(lf);
         return this;
     }
 
@@ -31,7 +39,11 @@ public class LfLst extends YangElement {
             return false;
         }
         LfLst lfLst = (LfLst) obj;
-        if (!this.lfs.equals(lfLst.lfs)) {
+        if (this.lfs == null) {
+            if (lfLst.lfs != null) {
+                return false;
+            }
+        } else if (!this.lfs.equals(lfLst.lfs)) {
             return false;
         }
         return true;