TreeLayout { public void checkTree() { Map<TreeNode, TreeNode> nodes = this.useIdentity ? new IdentityHashMap<TreeNode, TreeNode>() :new HashMap<TreeNode,TreeNode>(); addUniqueNodes(nodes,tree.getRoot()); } TreeLayout(TreeForTreeLayout<TreeNode> tree,
			NodeExtentProvider<TreeNode> nodeExtentProvider,
			Configuration<TreeNode> configuration, boolean useIdentity);  TreeLayout(TreeForTreeLayout<TreeNode> tree,
			NodeExtentProvider<TreeNode> nodeExtentProvider,
			Configuration<TreeNode> configuration); TreeForTreeLayout<TreeNode> getTree(); NodeExtentProvider<TreeNode> getNodeExtentProvider(); Configuration<TreeNode> getConfiguration(); Rectangle2D getBounds(); int getLevelCount(); double getSizeOfLevel(int level); Map<TreeNode, Rectangle2D.Double> getNodeBounds(); void checkTree(); void dumpTree(PrintStream printStream, DumpConfiguration dumpConfiguration); void dumpTree(PrintStream printStream);  }
@Test public void testCheckTree_fail() { StringTreeNode root = createSampleTree_DuplicateNode(); TreeLayout<StringTreeNode> layout = layout(root); try { layout.checkTree(); fail("Exception expected"); } catch (Exception ex) { assertEquals("Node used more than once in tree: n1", ex.getMessage()); } }
@Test public void testCheckTree_success() { StringTreeNode root = createSampleTree_1(); TreeLayout<StringTreeNode> layout = layout(root); layout.checkTree(); }