X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=yang%2Fyang-data-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fdata%2Fimpl%2Fschema%2FBuilderTest.java;h=699d0b66177f5b4a01eb5f0392ee8588bc3b6378;hb=f24f264f6fa03f6e7a4a23fdef4576bcc0341aa9;hp=085e42dfc07263e52ee0c8880455d8573c4302f5;hpb=486e1cddf7553ed1b445e84cb7c68916846a4bca;p=yangtools.git diff --git a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/BuilderTest.java b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/BuilderTest.java index 085e42dfc0..699d0b6617 100644 --- a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/BuilderTest.java +++ b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/BuilderTest.java @@ -11,6 +11,7 @@ package org.opendaylight.yangtools.yang.data.impl.schema; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThrows; import static org.mockito.Mockito.mock; import java.io.File; @@ -130,9 +131,9 @@ public class BuilderTest { assertEquals(SIZE, orderedMapNodeCreateNull.size()); assertEquals(orderedMapNodeCreateNode.size(), orderedMapNodeCreateNull.size() - 1); assertEquals(NODE_IDENTIFIER_LIST, orderedMapNodeCreateSize.getIdentifier()); - assertEquals(LIST_MAIN_CHILD_1, orderedMapNodeCreateNull.getChild(0)); + assertEquals(LIST_MAIN_CHILD_1, orderedMapNodeCreateNull.childAt(0)); assertEquals(SIZE, orderedMapNodeCreateNull.size()); - assertEquals(orderedMapNodeSchemaAware.getChild(0), orderedMapNodeSchemaAwareMapNodeConst.getChild(0)); + assertEquals(orderedMapNodeSchemaAware.childAt(0), orderedMapNodeSchemaAwareMapNodeConst.childAt(0)); } @Test @@ -157,7 +158,7 @@ public class BuilderTest { assertNotNull(Builders.anyXmlBuilder()); assertNotNull(orderedLeafSetShemaAware); assertEquals(1, ((UserLeafSetNode)orderedLeafSet).size()); - assertEquals("baz", orderedLeafSet.getChild(0).body()); + assertEquals("baz", orderedLeafSet.childAt(0).body()); assertNull(orderedLeafSet.childByArg(BAR_PATH)); assertEquals(1, leafSetCollection.size()); assertEquals(1, SchemaAwareleafSetCollection.size()); @@ -211,16 +212,12 @@ public class BuilderTest { .build(); final UnkeyedListNode unkeyedListNodeCreated = ImmutableUnkeyedListNodeBuilder.create(unkeyedListNode) .build(); - try { - unkeyedListNodeSize.getChild(1); - } catch (IndexOutOfBoundsException e) { - // Ignored on purpose - } + + assertThrows(IndexOutOfBoundsException.class, () -> unkeyedListNodeSize.childAt(1)); assertNotNull(unkeyedListNodeSize.body()); - assertEquals(unkeyedListEntryNode, unkeyedListNodeCreated.getChild(0)); - assertEquals(unkeyedListNode.getNodeType().getLocalName(), unkeyedListNodeSize.getNodeType() - .getLocalName()); + assertEquals(unkeyedListEntryNode, unkeyedListNodeCreated.childAt(0)); + assertEquals(unkeyedListNode.getNodeType().getLocalName(), unkeyedListNodeSize.getNodeType().getLocalName()); assertNotNull(unkeyedListNodeCreated); }