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=53183c611cf54329d5555b2de8b56b01cedfdf0d;hb=f3ba8a814797fb5d50e24e3f9144f01406121464;hp=94791cfe8d878b7c8e6ef73a5ac6829e7b2a9555;hpb=702ba6faa3f7f2f6bd8ae02b3bc1abc06aea1c26;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 94791cfe8d..53183c611c 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 @@ -1,7 +1,15 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ 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; @@ -11,16 +19,16 @@ 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.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"); @@ -34,17 +42,15 @@ public class RestGetAugmentedElementWhenEqualNamesTest { 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); } - }