assertThat(node.getParent(), is(nullValue()));
}
@Test
public void shouldInsertNewParentNodeInBetweenExistingParentAndChild() {
parent = new AstNode(name("parent"));
AstNode child1 = new AstNode(parent, name("childA"));
AstNode child2 = new AstNode(parent, name("childB"));
AstNode child3 = new AstNode(parent, name("childC"));
assertThat(parent.getFirstChild(), is(sameInstance(child1)));
assertThat(parent.getChild(1), is(sameInstance(child2)));
assertThat(parent.getLastChild(), is(sameInstance(child3)));
assertThat(parent.getChildCount(), is(3));
node = new AstNode(name("inserted"));
child2.insertAsParent(node);
assertThat(parent.getChildCount(), is(3));
assertThat(parent.getFirstChild(), is(sameInstance(child1)));
assertThat(parent.getChild(1), is(sameInstance(node)));
assertThat(parent.getLastChild(), is(sameInstance(child3)));