@Test public void singleLeafIsEnumeratedInNestedCase() throws Exception { Group g = new Group(0, "donkeykong", dummyDistribution()); Group child = new Group(1, "mario", dummyDistribution()); child.addSubGroup(new Group(2, "toad")); g.addSubGroup(child); List<Group> leaves = LeafGroups.enumerateFrom(g); assertThat(leaves.size(), is(1)); assertThat(leaves.get(0).getName(), is("toad")); }
public static List<Group> enumerateFrom(Group root) { List<Group> leaves = new ArrayList<>(); visitNode(root, leaves); return leaves; }
LeafGroups { public static List<Group> enumerateFrom(Group root) { List<Group> leaves = new ArrayList<>(); visitNode(root, leaves); return leaves; } }
LeafGroups { public static List<Group> enumerateFrom(Group root) { List<Group> leaves = new ArrayList<>(); visitNode(root, leaves); return leaves; }  }
LeafGroups { public static List<Group> enumerateFrom(Group root) { List<Group> leaves = new ArrayList<>(); visitNode(root, leaves); return leaves; }  static List<Group> enumerateFrom(Group root); }
LeafGroups { public static List<Group> enumerateFrom(Group root) { List<Group> leaves = new ArrayList<>(); visitNode(root, leaves); return leaves; }  static List<Group> enumerateFrom(Group root);  }