Hierarchy implements Serializable { public boolean fileHasDependency(File file, File dependency) { Validate.notNull(file, "File can't be null"); Validate.notNull(dependency, "Dependency can't be null"); HierarchyNode fileNode = getNode(file); Validate.notNull(fileNode, "File isn't in hierarchy: " + file); return fileNode.containsDependency(dependency); } 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 fileHasDependency() { hierarchy.fileHasDependency(null, left.getFile()); }
@Test(expected = IllegalArgumentException.class) public void fileHasDependency2() { hierarchy.fileHasDependency(left.getFile(), null); }
@Test(expected = IllegalArgumentException.class) public void fileHasDependency3() { hierarchy.fileHasDependency(new File(), left.getFile()); }
@Test public void fileHasDependency4() { assertTrue(hierarchy.fileHasDependency(root.getFile(), left.getFile())); assertTrue(hierarchy.fileHasDependency(root.getFile(), right.getFile())); assertTrue(hierarchy.fileHasDependency(right.getFile(), rightDep .getFile())); assertFalse(hierarchy.fileHasDependency(root.getFile(), new File())); }