GroupIT: Rename createGroup(name) to createUniqueGroup
The 'name' parameter is unused, but we can't just remove it because
there is already another test method named createGroup(). Instead,
remove the 'name' parameter and rename the method to createUniqueGroup.
Change-Id: I711cc455c940c5ff6d0218244d4acf6f1ca2ae3e
diff --git a/javatests/com/google/gerrit/acceptance/api/group/GroupsIT.java b/javatests/com/google/gerrit/acceptance/api/group/GroupsIT.java
index ee22141..6f25d28 100644
--- a/javatests/com/google/gerrit/acceptance/api/group/GroupsIT.java
+++ b/javatests/com/google/gerrit/acceptance/api/group/GroupsIT.java
@@ -147,7 +147,7 @@
}
// Creates a group, but with uniquified name.
- protected String createGroup(String name) throws Exception {
+ protected String createUniqueGroup() throws Exception {
// TODO(hanwen): rewrite this test in terms of UUID. This requires redoing the assertion helpers
// too.
AccountGroup.UUID g = groupOperations.newGroup().ownerGroupUuid(adminGroupUuid()).create();
@@ -155,6 +155,8 @@
}
protected String createGroup(String name, String owner) throws Exception {
+ // TODO(hanwen): rewrite to use groupOperations. This requires passing the owner
+ // group's UUID rathen than its name.
name = name(name);
GroupInput in = new GroupInput();
in.name = name;
@@ -191,7 +193,7 @@
@Test
public void addRemoveMember() throws Exception {
- String g = createGroup("users");
+ String g = createUniqueGroup();
gApi.groups().id(g).addMembers("user");
assertMembers(g, user);
@@ -206,7 +208,7 @@
// Fill the cache for the observed account.
groupIncludeCache.getGroupsWithMember(accountId);
- String groupName = createGroup("users");
+ String groupName = createUniqueGroup();
AccountGroup.UUID groupUuid = new AccountGroup.UUID(gApi.groups().id(groupName).get().id);
gApi.groups().id(groupName).addMembers(username);
@@ -238,7 +240,7 @@
@Test
public void addMultipleMembers() throws Exception {
- String g = createGroup("users");
+ String g = createUniqueGroup();
String u1 = name("u1");
accountOperations.newAccount().username(u1).create();
@@ -255,7 +257,7 @@
@Test
public void membersWithAtSignInUsernameCanBeAdded() throws Exception {
- String g = createGroup("users");
+ String g = createUniqueGroup();
String usernameWithAt = name("u1@something");
accountOperations.newAccount().username(usernameWithAt).create();
@@ -269,7 +271,7 @@
@Test
public void membersWithAtSignInUsernameAreNotConfusedWithSimilarUsernames() throws Exception {
- String g = createGroup("users");
+ String g = createUniqueGroup();
String usernameWithAt = name("u1@something");
accountOperations.newAccount().username(usernameWithAt).create();
String usernameWithoutAt = name("u1something");
@@ -291,8 +293,8 @@
@Test
public void includeRemoveGroup() throws Exception {
- String p = createGroup("parent");
- String g = createGroup("newGroup");
+ String p = createUniqueGroup();
+ String g = createUniqueGroup();
gApi.groups().id(p).addGroups(g);
assertIncludes(p, g);
@@ -302,7 +304,7 @@
@Test
public void includeExternalGroup() throws Exception {
- String g = createGroup("group");
+ String g = createUniqueGroup();
String subgroupUuid = SystemGroupBackend.REGISTERED_USERS.get();
gApi.groups().id(g).addGroups(subgroupUuid);
@@ -319,8 +321,8 @@
@Test
public void includeExistingGroup_OK() throws Exception {
- String p = createGroup("parent");
- String g = createGroup("newGroup");
+ String p = createUniqueGroup();
+ String g = createUniqueGroup();
gApi.groups().id(p).addGroups(g);
assertIncludes(p, g);
gApi.groups().id(p).addGroups(g);
@@ -329,9 +331,9 @@
@Test
public void addMultipleIncludes() throws Exception {
- String p = createGroup("parent");
- String g1 = createGroup("newGroup1");
- String g2 = createGroup("newGroup2");
+ String p = createUniqueGroup();
+ String g1 = createUniqueGroup();
+ String g2 = createUniqueGroup();
List<String> groups = new ArrayList<>();
groups.add(g1);
groups.add(g2);
@@ -637,22 +639,22 @@
@Test
public void listEmptyGroupIncludes() throws Exception {
- String gx = createGroup("gx");
+ String gx = createUniqueGroup();
assertThat(gApi.groups().id(gx).includedGroups()).isEmpty();
}
@Test
public void includeNonExistingGroup() throws Exception {
- String gx = createGroup("gx");
+ String gx = createUniqueGroup();
exception.expect(UnprocessableEntityException.class);
gApi.groups().id(gx).addGroups("non-existing");
}
@Test
public void listNonEmptyGroupIncludes() throws Exception {
- String gx = createGroup("gx");
- String gy = createGroup("gy");
- String gz = createGroup("gz");
+ String gx = createUniqueGroup();
+ String gy = createUniqueGroup();
+ String gz = createUniqueGroup();
gApi.groups().id(gx).addGroups(gy);
gApi.groups().id(gx).addGroups(gz);
assertIncludes(gApi.groups().id(gx).includedGroups(), gy, gz);
@@ -660,8 +662,8 @@
@Test
public void listOneIncludeMember() throws Exception {
- String gx = createGroup("gx");
- String gy = createGroup("gy");
+ String gx = createUniqueGroup();
+ String gy = createUniqueGroup();
gApi.groups().id(gx).addGroups(gy);
assertIncludes(gApi.groups().id(gx).includedGroups(), gy);
}
@@ -674,13 +676,13 @@
@Test
public void listEmptyGroupMembers() throws Exception {
- String group = createGroup("empty");
+ String group = createUniqueGroup();
assertThat(gApi.groups().id(group).members()).isEmpty();
}
@Test
public void listNonEmptyGroupMembers() throws Exception {
- String group = createGroup("group");
+ String group = createUniqueGroup();
String user1 = name("user1");
accountOperations.newAccount().username(user1).create();
String user2 = name("user2");
@@ -692,7 +694,7 @@
@Test
public void listOneGroupMember() throws Exception {
- String group = createGroup("group");
+ String group = createUniqueGroup();
String user = name("user1");
accountOperations.newAccount().username(user).create();
gApi.groups().id(group).addMembers(user);
@@ -702,17 +704,17 @@
@Test
public void listGroupMembersRecursively() throws Exception {
- String gx = createGroup("gx");
+ String gx = createUniqueGroup();
String ux = name("ux");
accountOperations.newAccount().username(ux).create();
gApi.groups().id(gx).addMembers(ux);
- String gy = createGroup("gy");
+ String gy = createUniqueGroup();
String uy = name("uy");
accountOperations.newAccount().username(uy).create();
gApi.groups().id(gy).addMembers(uy);
- String gz = createGroup("gz");
+ String gz = createUniqueGroup();
String uz = name("uz");
accountOperations.newAccount().username(uz).create();
gApi.groups().id(gz).addMembers(uz);
@@ -725,7 +727,7 @@
@Test
public void usersSeeTheirDirectMembershipWhenListingMembersRecursively() throws Exception {
- String group = createGroup("group");
+ String group = createUniqueGroup();
gApi.groups().id(group).addMembers(user.username);
setApiUser(user);
@@ -734,8 +736,8 @@
@Test
public void usersDoNotSeeTheirIndirectMembershipWhenListingMembersRecursively() throws Exception {
- String group1 = createGroup("group1");
- String group2 = createGroup("group2");
+ String group1 = createUniqueGroup();
+ String group2 = createUniqueGroup();
gApi.groups().id(group1).addGroups(group2);
gApi.groups().id(group2).addMembers(user.username);
@@ -791,7 +793,7 @@
@Test
public void getGroupsByOwner() throws Exception {
- String parent = createGroup("test-parent");
+ String parent = createUniqueGroup();
List<String> children =
Arrays.asList(createGroup("test-child1", parent), createGroup("test-child2", parent));