String expecting = "{5=[A, A], 6=[B, B, B], 7=[C], 8=[D, D]}";
assertEquals(expecting, found);
}
@Test public void testNoRepeatsVisit() throws Exception {
TreeWizard wiz = new TreeWizard(adaptor, tokens);
CommonTree t = (CommonTree)wiz.create("(A B C D)");
final List elements = new ArrayList();
wiz.visit(t, wiz.getTokenType("B"), new TreeWizard.Visitor() {
public void visit(Object t) {
elements.add(t);
}
});
String found = elements.toString();