X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-rest-connector%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frestconf%2Fimpl%2Fcnsn%2Fto%2Fjson%2Ftest%2FCnSnToJsonNotExistingLeafTypeTest.java;h=3ca29c8d65cd485002ef8b46ad7b675d4a4bc581;hp=24dba17c90cdff4e9a87d0a059160357dcbaad88;hb=484151212f586dd533984a11063c92799c414ec8;hpb=e64d758b45360b2ed8b7d8967fc1c7caaa7aa58f diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonNotExistingLeafTypeTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonNotExistingLeafTypeTest.java index 24dba17c90..3ca29c8d65 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonNotExistingLeafTypeTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonNotExistingLeafTypeTest.java @@ -9,6 +9,7 @@ package org.opendaylight.controller.sal.restconf.impl.cnsn.to.json.test; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; +import static org.opendaylight.controller.sal.restconf.impl.test.TestUtils.containsStringData; import java.io.IOException; import java.util.Collections; @@ -45,12 +46,12 @@ public class CnSnToJsonNotExistingLeafTypeTest extends YangAndXmlAndDataSchemaLo @Test public void incorrectTopLevelElementTest() throws WebApplicationException, IOException { String jsonOutput = null; - jsonOutput = TestUtils - .writeCompNodeWithSchemaContextToOutput(prepareCompositeNode(), - Collections.emptySet(), prepareDataSchemaNode(), - StructuredDataToJsonProvider.INSTANCE); + jsonOutput = TestUtils.writeCompNodeWithSchemaContextToOutput(prepareCompositeNode(), + Collections. emptySet(), prepareDataSchemaNode(), StructuredDataToJsonProvider.INSTANCE); assertNotNull(jsonOutput); - assertTrue(jsonOutput.contains("\"lf1\": \"\"")); + + // pattern for e.g. > "lf1" : "" < or >"lf1":""< + assertTrue(containsStringData(jsonOutput, "\"lf1\"", ":", "\"\"")); } private CompositeNode prepareCompositeNode() {