|
10 | 10 | import org.iot.dsa.io.json.JsonWriter; |
11 | 11 | import org.iot.dsa.node.DSFloat; |
12 | 12 | import org.iot.dsa.node.DSInt; |
| 13 | +import org.iot.dsa.node.DSList; |
| 14 | +import org.iot.dsa.node.DSMap; |
13 | 15 | import org.iot.dsa.node.DSNode; |
14 | 16 | import org.iot.dsa.node.DSString; |
15 | 17 | import org.junit.Assert; |
@@ -78,6 +80,29 @@ public void theTest() throws Exception { |
78 | 80 | Assert.assertTrue(orig.equals(decoded)); |
79 | 81 | } |
80 | 82 |
|
| 83 | + /** |
| 84 | + * Testing an "Already parented" bug that cropped up. |
| 85 | + */ |
| 86 | + @Test |
| 87 | + public void testMultipleGroups() throws Exception { |
| 88 | + DSNode node = new MyNode(); |
| 89 | + DSList list = new DSList(); |
| 90 | + list.add("a").add("b").add("c"); |
| 91 | + node.put("first", list); |
| 92 | + list = new DSList(); |
| 93 | + list.add("d").add("e").add("f"); |
| 94 | + node.put("second", list); |
| 95 | + node = decode(encode(node)); |
| 96 | + list = (DSList) node.get("first"); |
| 97 | + Assert.assertTrue(list.getString(0).equals("a")); |
| 98 | + Assert.assertTrue(list.getString(1).equals("b")); |
| 99 | + Assert.assertTrue(list.getString(2).equals("c")); |
| 100 | + list = (DSList) node.get("second"); |
| 101 | + Assert.assertTrue(list.getString(0).equals("d")); |
| 102 | + Assert.assertTrue(list.getString(1).equals("e")); |
| 103 | + Assert.assertTrue(list.getString(2).equals("f")); |
| 104 | + } |
| 105 | + |
81 | 106 | // Inner Classes |
82 | 107 | // ------------- |
83 | 108 |
|
|
0 commit comments