### Question:
HierarchyScanner extends AbstractScanner { public List<Edge> getEdges() { List<Edge> edges = new ArrayList<>(); for (Class<?> clazz : classes) { Class<?> superclass = clazz.getSuperclass(); if (isDomainClass(superclass)) { DomainObject child = new DomainObject(clazz); DomainObject parent = new DomainObject(superclass); edges.add(new Edge(child, parent, EdgeType.EXTENDS)); } } return edges; } HierarchyScanner(List<Class<?>> classes); List<Edge> getEdges();  }### Answer:
@Test public void createsProperHierarchy() { List<Class<?>> hierarchicalClasses = Lists.newArrayList(); hierarchicalClasses.add(Child.class); hierarchicalClasses.add(GrandChild.class); hierarchicalClasses.add(Parent.class); HierarchyScanner scanner = new HierarchyScanner(hierarchicalClasses); List<Edge> edges = scanner.getEdges(); assertThat(edges, containsInAnyOrder(parentToChild, childToGrandChild)); }
@Test public void doesNotIncludeNonDomainParents() { List<Class<?>> hierarchicalClasses = Lists.newArrayList(); hierarchicalClasses.add(Child.class); hierarchicalClasses.add(GrandChild.class); HierarchyScanner scanner = new HierarchyScanner(hierarchicalClasses); List<Edge> edges = scanner.getEdges(); assertThat(edges, contains(childToGrandChild)); }