Exemplo n.º 1
0
 public void testGetNextSibling_SingleChild() {
   ICompositeNode rootNode = builder.newRootNode("input");
   AbstractNode node = createNode();
   builder.addChild(rootNode, node);
   assertFalse(node.hasNextSibling());
   assertNull(node.getNextSibling());
 }
Exemplo n.º 2
0
 public void testGetRootNode_Parent() {
   AbstractNode node = createNode();
   ICompositeNode rootNode = builder.newRootNode("My input");
   ICompositeNode parent = builder.newCompositeNode(null, 0, rootNode);
   builder.addChild(parent, node);
   assertSame(rootNode, node.getRootNode());
 }
Exemplo n.º 3
0
 public void testTreeIterator_Bidi_NoParent() {
   AbstractNode node = createNode();
   BidiIterator<INode> iterator = node.iterator();
   assertSame(node, iterator.next());
   assertTrue(iterator.hasPrevious());
   assertSame(node, iterator.previous());
   assertTrue(iterator.hasNext());
 }
Exemplo n.º 4
0
 public void testGetNextSibling_LastChild() {
   ICompositeNode rootNode = builder.newRootNode("input");
   AbstractNode first = createNode();
   AbstractNode second = createNode();
   builder.addChild(rootNode, first);
   builder.addChild(rootNode, second);
   assertFalse(second.hasNextSibling());
   assertNull(second.getNextSibling());
 }
Exemplo n.º 5
0
 public void testGetNextSibling_FirstChild() {
   ICompositeNode rootNode = builder.newRootNode("input");
   AbstractNode first = createNode();
   AbstractNode second = createNode();
   builder.addChild(rootNode, first);
   builder.addChild(rootNode, second);
   assertTrue(first.hasNextSibling());
   assertSame(second, first.getNextSibling());
 }
Exemplo n.º 6
0
 public void testGetPreviousSibling_LastChild() {
   ICompositeNode rootNode = builder.newRootNode("input");
   AbstractNode first = createNode();
   AbstractNode second = createNode();
   builder.addChild(rootNode, first);
   builder.addChild(rootNode, second);
   assertTrue(second.hasPreviousSibling());
   assertSame(first, second.getPreviousSibling());
   assertTrue(second.hasSiblings());
 }
Exemplo n.º 7
0
 public void testTreeIterator_Bidi() {
   ICompositeNode rootNode = builder.newRootNode("input");
   AbstractNode node = createNode();
   builder.addChild(rootNode, node);
   BidiIterator<INode> iterator = node.iterator();
   assertSame(node, iterator.next());
   assertTrue(iterator.hasPrevious());
   assertSame(node, iterator.previous());
   assertTrue(iterator.hasNext());
 }
Exemplo n.º 8
0
 public void testIterator_Previous() {
   AbstractNode node = createNode();
   BidiIterator<INode> iterator = node.iterator();
   assertTrue(iterator.hasPrevious());
   assertSame(node, iterator.previous());
   assertFalse(iterator.hasPrevious());
   try {
     iterator.previous();
     fail("Expected NoSuchElementException");
   } catch (NoSuchElementException e) {
     // ok
   }
 }
Exemplo n.º 9
0
 public void testTreeIterator_Next_NoParent() {
   AbstractNode node = createNode();
   BidiIterator<INode> iterator = node.iterator();
   assertTrue(iterator.hasNext());
   assertSame(node, iterator.next());
   assertFalse(iterator.hasNext());
   try {
     iterator.next();
     fail("Expected NoSuchElementException");
   } catch (NoSuchElementException e) {
     // ok
   }
 }
Exemplo n.º 10
0
 public void testTreeIterator_Previous() {
   ICompositeNode rootNode = builder.newRootNode("input");
   AbstractNode node = createNode();
   builder.addChild(rootNode, node);
   BidiIterator<INode> iterator = node.iterator();
   assertTrue(iterator.hasPrevious());
   assertSame(node, iterator.previous());
   assertFalse(iterator.hasPrevious());
   try {
     iterator.previous();
     fail("Expected NoSuchElementException");
   } catch (NoSuchElementException e) {
     // ok
   }
 }
Exemplo n.º 11
0
 public void testGetRootNode_NoRoot() {
   AbstractNode node = createNode();
   ICompositeNode parent = new CompositeNode();
   builder.addChild(parent, node);
   assertNull(node.getRootNode());
 }
Exemplo n.º 12
0
 public void testGetRootNode_NoParent() {
   AbstractNode node = createNode();
   assertNull(node.getRootNode());
 }
Exemplo n.º 13
0
 public void testGetRootNode() {
   AbstractNode node = createNode();
   ICompositeNode rootNode = builder.newRootNode("My input");
   builder.addChild(rootNode, node);
   assertSame(rootNode, node.getRootNode());
 }
Exemplo n.º 14
0
 public void testGetParent() {
   AbstractNode node = createNode();
   ICompositeNode parent = builder.newRootNode("input");
   builder.addChild(parent, node);
   assertSame(parent, node.getParent());
 }