use of org.eclipse.xtext.nodemodel.impl.AbstractNode in project xtext-core by eclipse.
the class AbstractNodeTest method testGetNextSibling_FirstChild.
@Test
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());
}
use of org.eclipse.xtext.nodemodel.impl.AbstractNode in project xtext-core by eclipse.
the class AbstractNodeTest method testGetRootNode.
@Test
public void testGetRootNode() {
AbstractNode node = createNode();
ICompositeNode rootNode = builder.newRootNode("My input");
builder.addChild(rootNode, node);
assertSame(rootNode, node.getRootNode());
}
use of org.eclipse.xtext.nodemodel.impl.AbstractNode in project xtext-core by eclipse.
the class AbstractNodeTest method testGetNextSibling_SingleChild.
@Test
public void testGetNextSibling_SingleChild() {
ICompositeNode rootNode = builder.newRootNode("input");
AbstractNode node = createNode();
builder.addChild(rootNode, node);
assertFalse(node.hasNextSibling());
assertNull(node.getNextSibling());
}
use of org.eclipse.xtext.nodemodel.impl.AbstractNode in project xtext-core by eclipse.
the class AbstractNodeTest method testIterator_Next.
@Test
public void testIterator_Next() {
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
}
}
use of org.eclipse.xtext.nodemodel.impl.AbstractNode in project xtext-core by eclipse.
the class AbstractNodeTest method testGetParent.
@Test
public void testGetParent() {
AbstractNode node = createNode();
ICompositeNode parent = builder.newRootNode("input");
builder.addChild(parent, node);
assertSame(parent, node.getParent());
}
Aggregations