use of org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableUnkeyedListNodeBuilder in project yangtools by opendaylight.
the class BuilderTest method immutableUnkeyedListNodeBuilderTest.
@Test
public void immutableUnkeyedListNodeBuilderTest() {
final UnkeyedListEntryNode unkeyedListEntryNode = ImmutableUnkeyedListEntryNodeBuilder.create().withNodeIdentifier(NODE_IDENTIFIER_LEAF).build();
final ImmutableUnkeyedListNodeBuilder immutableUnkeyedListNodeBuilder = (ImmutableUnkeyedListNodeBuilder) ImmutableUnkeyedListNodeBuilder.create();
final UnkeyedListNode unkeyedListNode = immutableUnkeyedListNodeBuilder.withNodeIdentifier(NODE_IDENTIFIER_LEAF_LIST).addChild(unkeyedListEntryNode).build();
final UnkeyedListNode unkeyedListNodeSize = ImmutableUnkeyedListNodeBuilder.create(1).withNodeIdentifier(NODE_IDENTIFIER_LEAF_LIST).build();
final UnkeyedListNode unkeyedListNodeCreated = ImmutableUnkeyedListNodeBuilder.create(unkeyedListNode).build();
assertThrows(IndexOutOfBoundsException.class, () -> unkeyedListNodeSize.childAt(1));
assertNotNull(unkeyedListNodeSize.body());
assertEquals(unkeyedListEntryNode, unkeyedListNodeCreated.childAt(0));
assertEquals(unkeyedListNode.getIdentifier(), unkeyedListNodeSize.getIdentifier());
assertNotNull(unkeyedListNodeCreated);
}
Aggregations