assertEquals(expecting, t.toStringTree());
t.sanityCheckParentAndChildIndexes();
}
@Test public void testReplaceOneWithTwoInMiddle() throws Exception {
CommonTree t = new CommonTree(new CommonToken(99, "a"));
t.addChild(new CommonTree(new CommonToken(99, "b")));
t.addChild(new CommonTree(new CommonToken(99, "c")));
t.addChild(new CommonTree(new CommonToken(99, "d")));
CommonTree newChildren = (CommonTree)adaptor.nil();
newChildren.addChild(new CommonTree(new CommonToken(99,"x")));
newChildren.addChild(new CommonTree(new CommonToken(99,"y")));
t.replaceChildren(1, 1, newChildren);
String expecting = "(a b x y d)";
assertEquals(expecting, t.toStringTree());
t.sanityCheckParentAndChildIndexes();