@Test public void testModifyGroup() { Set<Group> groups = cfg.getGroups(); Group grp = findGroup(groups, "apache"); Assert.assertNotNull(grp); Assert.assertEquals(grp.getName(), "apache"); Assert.assertEquals(grp.getPattern(), "apache-.*"); invokeMethod("modifyGroup", new Class<?>[]{Set.class, String.class, String.class, String.class}, new Object[]{groups, "apache", "different pattern", null}); grp = findGroup(groups, "apache"); Assert.assertNotNull(grp); Assert.assertEquals(grp.getName(), "apache"); Assert.assertEquals(grp.getPattern(), "different pattern"); }
private static boolean modifyGroup(Set<Group> groups, String groupname, String grouppattern, String parent) { Group g = new Group(groupname, grouppattern); if (updateGroup(groups, groupname, grouppattern)) { return true; } if (parent != null) { if (insertToParent(groups, parent, g)) { groups.add(g); return true; } return false; } groups.add(g); return true; }
Groups { private static boolean modifyGroup(Set<Group> groups, String groupname, String grouppattern, String parent) { Group g = new Group(groupname, grouppattern); if (updateGroup(groups, groupname, grouppattern)) { return true; } if (parent != null) { if (insertToParent(groups, parent, g)) { groups.add(g); return true; } return false; } groups.add(g); return true; } }
Groups { private static boolean modifyGroup(Set<Group> groups, String groupname, String grouppattern, String parent) { Group g = new Group(groupname, grouppattern); if (updateGroup(groups, groupname, grouppattern)) { return true; } if (parent != null) { if (insertToParent(groups, parent, g)) { groups.add(g); return true; } return false; } groups.add(g); return true; } private  Groups(); }
Groups { private static boolean modifyGroup(Set<Group> groups, String groupname, String grouppattern, String parent) { Group g = new Group(groupname, grouppattern); if (updateGroup(groups, groupname, grouppattern)) { return true; } if (parent != null) { if (insertToParent(groups, parent, g)) { groups.add(g); return true; } return false; } groups.add(g); return true; } private  Groups(); static void main(String[] argv); }
Groups { private static boolean modifyGroup(Set<Group> groups, String groupname, String grouppattern, String parent) { Group g = new Group(groupname, grouppattern); if (updateGroup(groups, groupname, grouppattern)) { return true; } if (parent != null) { if (insertToParent(groups, parent, g)) { groups.add(g); return true; } return false; } groups.add(g); return true; } private  Groups(); static void main(String[] argv);  }