void (TreePath parent, TreeNode node, int count, boolean error, Walker walker, Object... expected) { walker.start(parent, node); switch (walker.promise().getState()) { case PENDING -> throw new IllegalStateException("not processed"); case SUCCEEDED -> { if (error) throw new IllegalStateException("not rejected"); } case REJECTED -> { if (!error) throw new IllegalStateException("not fulfilled"); } } TreeVisitor wrapper = getField(AbstractTreeWalker.class, walker, TreeVisitor.class, "visitor"); assertEquals(Integer.valueOf(count), getField(Wrapper.class, wrapper, int.class, "count")); assertResult(walker, TreePathUtil.convertArrayToTreePath(expected)); }