@Test public void testDeleteGroup() { Set<Group> groups = cfg.getGroups(); invokeMethod("deleteGroup", new Class<?>[]{Set.class, String.class}, new Object[]{groups, "random not existing group"}); Assert.assertEquals(6, cfg.getGroups().size()); invokeMethod("deleteGroup", new Class<?>[]{Set.class, String.class}, new Object[]{groups, "apache"}); Assert.assertEquals(5, cfg.getGroups().size()); invokeMethod("deleteGroup", new Class<?>[]{Set.class, String.class}, new Object[]{groups, "ctags"}); Assert.assertEquals(1, cfg.getGroups().size()); }
private static void deleteGroup(Set<Group> groups, String groupname) { for (Group g : groups) { if (g.getName().equals(groupname)) { groups.remove(g); groups.removeAll(g.getDescendants()); return; } } }
Groups { private static void deleteGroup(Set<Group> groups, String groupname) { for (Group g : groups) { if (g.getName().equals(groupname)) { groups.remove(g); groups.removeAll(g.getDescendants()); return; } } } }
Groups { private static void deleteGroup(Set<Group> groups, String groupname) { for (Group g : groups) { if (g.getName().equals(groupname)) { groups.remove(g); groups.removeAll(g.getDescendants()); return; } } } private  Groups(); }
Groups { private static void deleteGroup(Set<Group> groups, String groupname) { for (Group g : groups) { if (g.getName().equals(groupname)) { groups.remove(g); groups.removeAll(g.getDescendants()); return; } } } private  Groups(); static void main(String[] argv); }
Groups { private static void deleteGroup(Set<Group> groups, String groupname) { for (Group g : groups) { if (g.getName().equals(groupname)) { groups.remove(g); groups.removeAll(g.getDescendants()); return; } } } private  Groups(); static void main(String[] argv);  }