Hierarchy implements Serializable { @Override public String toString() { StringBuilder sb = new StringBuilder(30 + nodes.size() * 30); sb.append("Hierarchy for user=").append(project.getUserId()); sb.append(", project=").append(project.getName()).append(" {\n"); for (HierarchyNode node : nodes.values()) { sb.append(node).append("\n"); } sb.append("}"); return sb.toString(); } Hierarchy(Project project, Collection<HierarchyNode> collection); Project getProject(); HierarchyNode getNode(File file); int getFileCount(); boolean fileHasDependency(File file, File dependency); Collection<HierarchyNode> getAllNodes(); Set<HierarchyNode> getTopLevelNodes(); Set<HierarchyNode> getBottomLevelNodes(); Set<HierarchyNode> getDependenciesFor(HierarchyNode node); Set<HierarchyNode> getParentsFor(HierarchyNode node); Iterator<HierarchyNode> iteratorFlatHierarchy(); Iterator<HierarchyNode> iteratorXUsesYHierarchy(HierarchyNode node); Iterator<HierarchyNode> iteratorXUsedByYHierarchy(HierarchyNode node); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void testToString() { toStringPrint(hierarchy); assertEquals( "Hierarchy for user=userId, project=project_name {\nroot [left,right]\nright [right-dep]\nleft []\nright-dep []\n}", hierarchy.toString()); }