Hierarchy implements Serializable { public Set<HierarchyNode> getDependenciesFor(HierarchyNode node) { Validate.notNull(node, "Hierarchy node can't be null"); Set<File> nodeDependencies = node.getDependencies(); Set<HierarchyNode> dependencies = new LinkedHashSet<HierarchyNode>( nodeDependencies.size()); for (File f : nodeDependencies) { dependencies.add(nodes.get(f)); } return dependencies; } 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(expected = IllegalArgumentException.class) public void getDependenciesForNullArgument() { hierarchy.getDependenciesFor(null); }
@Test public void getDependenciesFor() { assertEquals(2, hierarchy.getDependenciesFor(root).size()); assertEquals(1, hierarchy.getDependenciesFor(right).size()); assertEquals(0, hierarchy.getDependenciesFor(left).size()); assertEquals(0, hierarchy.getDependenciesFor(rightDep).size()); }