1 package org.opendaylight.controller.sal.restconf.impl.cnsn.to.json.test;
3 import static org.junit.Assert.assertTrue;
6 import org.opendaylight.controller.sal.restconf.impl.test.TestUtils;
7 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
9 public class ToJsonWithAugmentTest {
12 * Test of json output when as input are specified composite node with empty
16 public void augmentedElementsToJson() {
18 CompositeNode compositeNode = TestUtils.loadCompositeNode("/cnsn-to-json/augmentation/xml/data.xml");
19 String jsonOutput = TestUtils.convertCompositeNodeDataAndYangToJson(compositeNode,
20 "/cnsn-to-json/augmentation", "/cnsn-to-json/augmentation/xml", "yang", "cont");
22 assertTrue(jsonOutput.contains("\"augment-leaf:lf2\": \"lf2\""));
23 assertTrue(jsonOutput.contains("\"augment-container:cont1\": {"));
24 assertTrue(jsonOutput.contains("\"augment-container:lf11\": \"lf11\""));
25 assertTrue(jsonOutput.contains("\"augment-list:lst1\": ["));
26 assertTrue(jsonOutput.contains("\"augment-list:lf11\": \"lf1_1\""));
27 assertTrue(jsonOutput.contains("\"augment-list:lf11\": \"lf1_2\""));
28 assertTrue(jsonOutput.contains("\"augment-leaflist:lflst1\": ["));