/** * Retrieves a node with the given data. * * @param root the tree to search. * @param data the data to search for. * @return the node with the given data, or null if not found. */ private static TreeNode getNode(final TreeNode root, final String data) { for (Iterator<TreeNode> i = root.depthFirst(); i.hasNext();) { TreeNode node = i.next(); if (node instanceof TestNode && Util.equals(((TestNode) node).data, data)) { return node; } } return null; }