*
* @param <V> child type
*/
+// FIXME: 8.0.0: we really want to do a List<@NonNull V> body(), but need to reconcile that with key-based lookup in
+// implementations -- and those are using only a Map internally.
public interface OrderedNodeContainer<V extends NormalizedNode>
extends NormalizedNodeContainer<V>, MixinNode, OrderingAware.User {
@Override
* @return Child Node
* @throws IndexOutOfBoundsException Out of bound Exception
*/
- // FIXME: 7.0.0: rename to 'childAt(int)'
- @NonNull V getChild(int position);
-
- // FIXME: 7.0.0: do we really mean 'List' for body?
- // @Override
- // List<V> body();
+ @NonNull V childAt(int position);
@Override
int hashCode();
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;
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
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());
.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);
}