X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-rest-connector%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frestconf%2Fimpl%2Ftest%2FRestGetAugmentedElementWhenEqualNamesTest.java;h=856d8c006b6c40349d2a1fd646cc70db6bd5fd62;hb=d7d67c58c7aacbb320f6d3d43918f80ccc2808d1;hp=a6391894c2f044dd13d98518db473c952e44d1e8;hpb=9303b14b9dba1a940f0d0a6fe1604bfcd0f9e294;p=controller.git diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetAugmentedElementWhenEqualNamesTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetAugmentedElementWhenEqualNamesTest.java index a6391894c2..856d8c006b 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetAugmentedElementWhenEqualNamesTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetAugmentedElementWhenEqualNamesTest.java @@ -9,25 +9,25 @@ package org.opendaylight.controller.sal.restconf.impl.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.io.FileNotFoundException; - import org.junit.BeforeClass; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.opendaylight.controller.sal.restconf.impl.ControllerContext; -import org.opendaylight.controller.sal.restconf.impl.InstanceIdWithSchemaNode; -import org.opendaylight.controller.sal.restconf.impl.ResponseException; +import org.opendaylight.controller.sal.restconf.impl.InstanceIdentifierContext; +import org.opendaylight.controller.sal.restconf.impl.RestconfDocumentedException; import org.opendaylight.yangtools.yang.model.api.SchemaContext; public class RestGetAugmentedElementWhenEqualNamesTest { - + private static ControllerContext controllerContext = ControllerContext.getInstance(); - + @Rule public ExpectedException exception = ExpectedException.none(); - + @BeforeClass public static void init() throws FileNotFoundException { SchemaContext schemaContextTestModule = TestUtils.loadSchemaContext("/common/augment/yang"); @@ -36,22 +36,19 @@ public class RestGetAugmentedElementWhenEqualNamesTest { @Test public void augmentedNodesInUri() { - InstanceIdWithSchemaNode iiWithData = controllerContext.toInstanceIdentifier("main:cont/augment-main-a:cont1"); + InstanceIdentifierContext iiWithData = controllerContext.toInstanceIdentifier("main:cont/augment-main-a:cont1"); assertEquals("ns:augment:main:a", iiWithData.getSchemaNode().getQName().getNamespace().toString()); iiWithData = controllerContext.toInstanceIdentifier("main:cont/augment-main-b:cont1"); assertEquals("ns:augment:main:b", iiWithData.getSchemaNode().getQName().getNamespace().toString()); } - + @Test public void nodeWithoutNamespaceHasMoreAugments() { - boolean exceptionCaught = false; try { controllerContext.toInstanceIdentifier("main:cont/cont1"); - } catch (ResponseException e) { - assertTrue(((String) e.getResponse().getEntity()).contains("is added as augment from more than one module")); - exceptionCaught = true; + fail("Expected exception"); + } catch (RestconfDocumentedException e) { + assertTrue(e.getErrors().get(0).getErrorMessage().contains("is added as augment from more than one module")); } - assertTrue(exceptionCaught); } - }