void (@NotNull T root) { for (T element = next(root, root, isDown); element != null && !stopped; element = next(element, root, isDown)) { isDown = false; // if client visitor did not call default visitElement it means skip subtree if (isUnitTestMode) { T parent = myWalker.getParent(element); T next = myWalker.getNextSibling(element); visit(element); assert myWalker.getNextSibling(element) == next : "Next sibling of the element '" + element + "' changed. Was: " + next + "; " + "Now:" + myWalker.getNextSibling(element) + "; Root:" + root; assert myWalker.getParent(element) == parent : "Parent of the element '" + element + "' changed. Was: " + parent + "; " + "Now:" + myWalker.getParent(element) + "; Root:" + root; } else { visit(element); } } }