@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)); }
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 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 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); }
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(); }
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();  }