Merge branch 'stable-3.0' into stable-3.1

* stable-3.0:
  Add Gatling e2e-test for rename-project
  Bump Bazel version to 3.5.0

Change-Id: Ibd09263648a8b2c94aee61fec181448774ca687b
diff --git a/WORKSPACE b/WORKSPACE
index 9e27745..0abed59 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,7 +3,7 @@
 load("//:bazlets.bzl", "load_bazlets")
 
 load_bazlets(
-    commit = "6d2b8f41ed34dad925b767399d1e4be378abb029",
+    commit = "3f9dadc615dc4053369a42d9ada37dafd8d4763c",
     #local_path = "/home/<user>/projects/bazlets",
 )
 
diff --git a/src/main/java/com/googlesource/gerrit/plugins/renameproject/LockUnlockProject.java b/src/main/java/com/googlesource/gerrit/plugins/renameproject/LockUnlockProject.java
index 170e0d6..8904144 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/renameproject/LockUnlockProject.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/renameproject/LockUnlockProject.java
@@ -14,8 +14,8 @@
 
 package com.googlesource.gerrit.plugins.renameproject;
 
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.extensions.client.ProjectState;
-import com.google.gerrit.reviewdb.client.Project;
 import com.google.gerrit.server.git.meta.MetaDataUpdate;
 import com.google.gerrit.server.project.ProjectCache;
 import com.google.gerrit.server.project.ProjectConfig;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/renameproject/RenameCommand.java b/src/main/java/com/googlesource/gerrit/plugins/renameproject/RenameCommand.java
index 80b1306..fce6fa8 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/renameproject/RenameCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/renameproject/RenameCommand.java
@@ -17,8 +17,8 @@
 import static com.googlesource.gerrit.plugins.renameproject.RenameProject.CANCELLATION_MSG;
 import static com.googlesource.gerrit.plugins.renameproject.RenameProject.WARNING_LIMIT;
 
+import com.google.gerrit.entities.Change;
 import com.google.gerrit.extensions.restapi.RestApiException;
-import com.google.gerrit.reviewdb.client.Change;
 import com.google.gerrit.server.CurrentUser;
 import com.google.gerrit.server.project.ProjectResource;
 import com.google.gerrit.server.project.ProjectState;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/renameproject/RenameLog.java b/src/main/java/com/googlesource/gerrit/plugins/renameproject/RenameLog.java
index 6449cba..e37edb1 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/renameproject/RenameLog.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/renameproject/RenameLog.java
@@ -16,9 +16,9 @@
 
 import com.google.common.collect.ListMultimap;
 import com.google.common.collect.MultimapBuilder;
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.extensions.systemstatus.ServerInformation;
 import com.google.gerrit.json.OutputFormat;
-import com.google.gerrit.reviewdb.client.Project;
 import com.google.gerrit.server.AuditEvent;
 import com.google.gerrit.server.IdentifiedUser;
 import com.google.gerrit.server.audit.AuditService;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/renameproject/RenameProject.java b/src/main/java/com/googlesource/gerrit/plugins/renameproject/RenameProject.java
index c7937b6..3104491 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/renameproject/RenameProject.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/renameproject/RenameProject.java
@@ -20,6 +20,9 @@
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Strings;
 import com.google.common.cache.Cache;
+import com.google.gerrit.entities.Change;
+import com.google.gerrit.entities.Change.Id;
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.extensions.annotations.PluginName;
 import com.google.gerrit.extensions.api.access.PluginPermission;
 import com.google.gerrit.extensions.restapi.AuthException;
@@ -27,9 +30,6 @@
 import com.google.gerrit.extensions.restapi.ResourceConflictException;
 import com.google.gerrit.extensions.restapi.Response;
 import com.google.gerrit.extensions.restapi.RestModifyView;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Change.Id;
-import com.google.gerrit.reviewdb.client.Project;
 import com.google.gerrit.server.CurrentUser;
 import com.google.gerrit.server.IdentifiedUser;
 import com.google.gerrit.server.extensions.events.PluginEvent;
@@ -61,7 +61,7 @@
 public class RenameProject implements RestModifyView<ProjectResource, Input> {
 
   @Override
-  public Object apply(ProjectResource resource, Input input)
+  public Response<?> apply(ProjectResource resource, Input input)
       throws IOException, AuthException, BadRequestException, ResourceConflictException,
           InterruptedException, ConfigInvalidException, RenameRevertException {
     assertCanRename(resource, input, Optional.empty());
@@ -178,7 +178,7 @@
 
       assertNewNameNotNull(input);
       assertRenamePermission(rsrc);
-      renamePreconditions.assertCanRename(rsrc, new Project.NameKey(input.name));
+      renamePreconditions.assertCanRename(rsrc, Project.nameKey(input.name));
       log.debug("Rename preconditions check successful.");
     } catch (CannotRenameProjectException e) {
       throw new ResourceConflictException(e.getMessage());
@@ -189,7 +189,7 @@
       List<Change.Id> changeIds, ProjectResource rsrc, Input input, Optional<ProgressMonitor> pm)
       throws InterruptedException, ConfigInvalidException, IOException, RenameRevertException {
     Project.NameKey oldProjectKey = rsrc.getNameKey();
-    Project.NameKey newProjectKey = new Project.NameKey(input.name);
+    Project.NameKey newProjectKey = Project.nameKey(input.name);
     Exception ex = null;
     stepsPerformed.clear();
     try {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/renameproject/RevertRenameProject.java b/src/main/java/com/googlesource/gerrit/plugins/renameproject/RevertRenameProject.java
index 0671c71..484492a 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/renameproject/RevertRenameProject.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/renameproject/RevertRenameProject.java
@@ -14,9 +14,9 @@
 
 package com.googlesource.gerrit.plugins.renameproject;
 
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Change.Id;
-import com.google.gerrit.reviewdb.client.Project;
+import com.google.gerrit.entities.Change;
+import com.google.gerrit.entities.Change.Id;
+import com.google.gerrit.entities.Project;
 import com.google.inject.Inject;
 import com.googlesource.gerrit.plugins.renameproject.RenameProject.Step;
 import com.googlesource.gerrit.plugins.renameproject.cache.CacheRenameHandler;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/renameproject/cache/CacheRenameHandler.java b/src/main/java/com/googlesource/gerrit/plugins/renameproject/cache/CacheRenameHandler.java
index 4526489..5b16875 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/renameproject/cache/CacheRenameHandler.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/renameproject/cache/CacheRenameHandler.java
@@ -14,7 +14,7 @@
 
 package com.googlesource.gerrit.plugins.renameproject.cache;
 
-import com.google.gerrit.reviewdb.client.Project;
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.server.project.ProjectCache;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/renameproject/conditions/RenamePreconditions.java b/src/main/java/com/googlesource/gerrit/plugins/renameproject/conditions/RenamePreconditions.java
index 3e30f6e..204c564 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/renameproject/conditions/RenamePreconditions.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/renameproject/conditions/RenamePreconditions.java
@@ -14,15 +14,14 @@
 
 package com.googlesource.gerrit.plugins.renameproject.conditions;
 
+import com.google.gerrit.entities.BranchNameKey;
+import com.google.gerrit.entities.Project;
+import com.google.gerrit.entities.RefNames;
 import com.google.gerrit.extensions.common.ProjectInfo;
-import com.google.gerrit.extensions.restapi.RestApiException;
-import com.google.gerrit.reviewdb.client.Branch;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gerrit.reviewdb.client.RefNames;
+import com.google.gerrit.extensions.restapi.Response;
 import com.google.gerrit.server.config.AllProjectsName;
 import com.google.gerrit.server.config.AllUsersName;
 import com.google.gerrit.server.git.GitRepositoryManager;
-import com.google.gerrit.server.permissions.PermissionBackendException;
 import com.google.gerrit.server.project.ProjectResource;
 import com.google.gerrit.server.restapi.project.ListChildProjects;
 import com.google.gerrit.server.submit.MergeOpRepoManager;
@@ -91,17 +90,18 @@
 
   private void assertHasNoChildProjects(ProjectResource rsrc) throws CannotRenameProjectException {
     try {
-      List<ProjectInfo> children = listChildProjectsProvider.get().apply(rsrc);
-      if (!children.isEmpty()) {
+      Response<List<ProjectInfo>> children = listChildProjectsProvider.get().apply(rsrc);
+      if (!children.value().isEmpty()) {
         String childrenString =
             String.join(
-                ", ", children.stream().map(info -> info.name).collect(Collectors.toList()));
+                ", ",
+                children.value().stream().map(info -> info.name).collect(Collectors.toList()));
         String message =
             String.format("Cannot rename project because it has children: %s", childrenString);
         log.error(message);
         throw new CannotRenameProjectException(message);
       }
-    } catch (PermissionBackendException | RestApiException e) {
+    } catch (Exception e) {
       throw new CannotRenameProjectException(e);
     }
   }
@@ -109,12 +109,12 @@
   private void assertIsNotSubscribed(Project.NameKey key) throws CannotRenameProjectException {
     try (Repository repo = repoManager.openRepository(key);
         MergeOpRepoManager orm = ormProvider.get()) {
-      Set<Branch.NameKey> branches = new HashSet<>();
-      for (Ref ref : repo.getRefDatabase().getRefs(RefNames.REFS_HEADS).values()) {
-        branches.add(new Branch.NameKey(key, ref.getName()));
+      Set<BranchNameKey> branches = new HashSet<>();
+      for (Ref ref : repo.getRefDatabase().getRefsByPrefix(RefNames.REFS_HEADS)) {
+        branches.add(BranchNameKey.create(key, ref.getName()));
       }
       SubmoduleOp sub = subOpFactory.create(branches, orm);
-      for (Branch.NameKey b : branches) {
+      for (BranchNameKey b : branches) {
         if (!sub.superProjectSubscriptionsForSubmoduleBranch(b).isEmpty()) {
           String message = "Cannot rename a project subscribed to by the other projects";
           log.error(message);
diff --git a/src/main/java/com/googlesource/gerrit/plugins/renameproject/database/DatabaseRenameHandler.java b/src/main/java/com/googlesource/gerrit/plugins/renameproject/database/DatabaseRenameHandler.java
index 2ed4ad5..7019327 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/renameproject/database/DatabaseRenameHandler.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/renameproject/database/DatabaseRenameHandler.java
@@ -16,9 +16,9 @@
 
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
-import com.google.gerrit.reviewdb.client.Account;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
+import com.google.gerrit.entities.Account;
+import com.google.gerrit.entities.Change;
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.server.ServerInitiated;
 import com.google.gerrit.server.account.AccountState;
 import com.google.gerrit.server.account.AccountsUpdate;
@@ -122,12 +122,11 @@
   private void updateWatchEntries(Project.NameKey newProjectKey)
       throws IOException, ConfigInvalidException {
     for (AccountState a : accountQueryProvider.get().byWatchedProject(oldProjectKey)) {
-      Account.Id accountId = a.getAccount().getId();
-      ImmutableMap<ProjectWatchKey, ImmutableSet<NotifyType>> projectWatches =
-          a.getProjectWatches();
+      Account.Id accountId = a.account().id();
+      ImmutableMap<ProjectWatchKey, ImmutableSet<NotifyType>> projectWatches = a.projectWatches();
       Map<ProjectWatchKey, Set<NotifyType>> newProjectWatches = new HashMap<>();
       List<ProjectWatchKey> oldProjectWatches = new ArrayList<>();
-      for (ProjectWatchKey watchKey : a.getProjectWatches().keySet()) {
+      for (ProjectWatchKey watchKey : a.projectWatches().keySet()) {
         if (oldProjectKey.equals(watchKey.project())) {
           newProjectWatches.put(
               ProjectWatchKey.create(newProjectKey, watchKey.filter()),
@@ -151,14 +150,14 @@
           } catch (ConfigInvalidException e) {
             log.error(
                 "Updating watch entry for user {} in project {} failed. Watch config found invalid.",
-                a.getUserName(),
+                a.userName(),
                 newProjectKey.get(),
                 e);
             throw e;
           } catch (IOException e) {
             log.error(
                 "Updating watch entry for user {} in project {} failed.",
-                a.getUserName(),
+                a.userName(),
                 newProjectKey.get(),
                 e);
             throw e;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/renameproject/database/IndexUpdateHandler.java b/src/main/java/com/googlesource/gerrit/plugins/renameproject/database/IndexUpdateHandler.java
index f75b784..81fa156 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/renameproject/database/IndexUpdateHandler.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/renameproject/database/IndexUpdateHandler.java
@@ -15,8 +15,8 @@
 package com.googlesource.gerrit.plugins.renameproject.database;
 
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
+import com.google.gerrit.entities.Change;
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.server.index.change.ChangeIndexer;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/renameproject/fs/FilesystemRenameHandler.java b/src/main/java/com/googlesource/gerrit/plugins/renameproject/fs/FilesystemRenameHandler.java
index 1572d53..a1ea2b1 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/renameproject/fs/FilesystemRenameHandler.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/renameproject/fs/FilesystemRenameHandler.java
@@ -14,7 +14,7 @@
 
 package com.googlesource.gerrit.plugins.renameproject.fs;
 
-import com.google.gerrit.reviewdb.client.Project;
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.server.git.GitRepositoryManager;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
diff --git a/src/test/java/com/googlesource/gerrit/plugins/renameproject/RenameIT.java b/src/test/java/com/googlesource/gerrit/plugins/renameproject/RenameIT.java
index 7df0e60..9fe5a0c 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/renameproject/RenameIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/renameproject/RenameIT.java
@@ -24,10 +24,10 @@
 import com.google.gerrit.acceptance.UseLocalDisk;
 import com.google.gerrit.acceptance.UseSsh;
 import com.google.gerrit.acceptance.testsuite.request.RequestScopeOperations;
+import com.google.gerrit.entities.Change.Id;
+import com.google.gerrit.entities.Project;
+import com.google.gerrit.entities.Project.NameKey;
 import com.google.gerrit.extensions.client.ProjectWatchInfo;
-import com.google.gerrit.reviewdb.client.Change.Id;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gerrit.reviewdb.client.Project.NameKey;
 import com.google.gerrit.server.project.ProjectState;
 import com.google.inject.Inject;
 import com.googlesource.gerrit.plugins.renameproject.RenameProject.Input;
@@ -60,10 +60,10 @@
     adminSshSession.exec(PLUGIN_NAME + " " + project.get() + " " + NEW_PROJECT_NAME);
 
     adminSshSession.assertSuccess();
-    ProjectState projectState = projectCache.get(new Project.NameKey(NEW_PROJECT_NAME));
+    ProjectState projectState = projectCache.get(Project.nameKey(NEW_PROJECT_NAME));
     assertThat(projectState).isNotNull();
     assertThat(queryProvider.get().byProject(project)).isEmpty();
-    assertThat(queryProvider.get().byProject(new Project.NameKey(NEW_PROJECT_NAME))).isNotEmpty();
+    assertThat(queryProvider.get().byProject(Project.nameKey(NEW_PROJECT_NAME))).isNotEmpty();
   }
 
   @Test
@@ -74,7 +74,7 @@
     adminSshSession.exec(PLUGIN_NAME + " " + project.get() + " " + newProjectName);
 
     adminSshSession.assertFailure();
-    ProjectState projectState = projectCache.get(new Project.NameKey(newProjectName));
+    ProjectState projectState = projectCache.get(Project.nameKey(newProjectName));
     assertThat(projectState).isNull();
   }
 
@@ -85,7 +85,7 @@
     adminSshSession.exec(PLUGIN_NAME + " " + allProjects.get() + " " + NEW_PROJECT_NAME);
 
     adminSshSession.assertFailure();
-    ProjectState projectState = projectCache.get(new Project.NameKey(NEW_PROJECT_NAME));
+    ProjectState projectState = projectCache.get(Project.nameKey(NEW_PROJECT_NAME));
     assertThat(projectState).isNull();
   }
 
diff --git a/src/test/java/com/googlesource/gerrit/plugins/renameproject/RevertRenameProjectTest.java b/src/test/java/com/googlesource/gerrit/plugins/renameproject/RevertRenameProjectTest.java
index f77d80e..b6e6057 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/renameproject/RevertRenameProjectTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/renameproject/RevertRenameProjectTest.java
@@ -21,10 +21,10 @@
 import com.google.gerrit.acceptance.PushOneCommit.Result;
 import com.google.gerrit.acceptance.TestPlugin;
 import com.google.gerrit.acceptance.UseLocalDisk;
+import com.google.gerrit.entities.Change;
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.extensions.api.changes.ChangeApi;
 import com.google.gerrit.extensions.common.ChangeInfo;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
 import com.google.gerrit.server.project.ProjectResource;
 import com.google.gerrit.server.project.ProjectState;
 import com.googlesource.gerrit.plugins.renameproject.RenameProject.Step;
@@ -55,7 +55,7 @@
     revertRenameProject = plugin.getSysInjector().getInstance(RevertRenameProject.class);
 
     oldProjectKey = project;
-    newProjectKey = new Project.NameKey(NEW_PROJECT_NAME);
+    newProjectKey = Project.nameKey(NEW_PROJECT_NAME);
 
     pm = Optional.of(Mockito.mock(ProgressMonitor.class));
 
diff --git a/src/test/java/com/googlesource/gerrit/plugins/renameproject/SubmoduleUtil.java b/src/test/java/com/googlesource/gerrit/plugins/renameproject/SubmoduleUtil.java
index 68515c4..be4dc37 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/renameproject/SubmoduleUtil.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/renameproject/SubmoduleUtil.java
@@ -17,7 +17,7 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import com.google.gerrit.common.data.SubscribeSection;
-import com.google.gerrit.reviewdb.client.Project.NameKey;
+import com.google.gerrit.entities.Project.NameKey;
 import com.google.gerrit.server.git.meta.MetaDataUpdate;
 import com.google.gerrit.server.git.meta.MetaDataUpdate.Server;
 import com.google.gerrit.server.project.ProjectCache;
diff --git a/src/test/java/com/googlesource/gerrit/plugins/renameproject/conditions/RenamePreconditionsTest.java b/src/test/java/com/googlesource/gerrit/plugins/renameproject/conditions/RenamePreconditionsTest.java
index e42e550..adc0791 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/renameproject/conditions/RenamePreconditionsTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/renameproject/conditions/RenamePreconditionsTest.java
@@ -17,11 +17,14 @@
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.extensions.common.ProjectInfo;
-import com.google.gerrit.reviewdb.client.Project;
+import com.google.gerrit.extensions.restapi.Response;
 import com.google.gerrit.server.CurrentUser;
 import com.google.gerrit.server.config.AllProjectsName;
+import com.google.gerrit.server.config.AllProjectsNameProvider;
 import com.google.gerrit.server.config.AllUsersName;
+import com.google.gerrit.server.config.AllUsersNameProvider;
 import com.google.gerrit.server.git.GitRepositoryManager;
 import com.google.gerrit.server.project.ProjectResource;
 import com.google.gerrit.server.project.ProjectState;
@@ -43,8 +46,6 @@
 @RunWith(MockitoJUnitRunner.class)
 public class RenamePreconditionsTest {
 
-  @Mock private AllProjectsName allProjects;
-  @Mock private AllUsersName allUsersName;
   @Mock private Provider<ListChildProjects> listChildProjectsProvider;
   @Mock private GitRepositoryManager repoManager;
   @Mock private SubmoduleOp.Factory subOpFactory;
@@ -56,12 +57,16 @@
   @Mock private Repository repo;
   @Mock private ListChildProjects listChildProjects;
 
+  private AllProjectsName allProjects;
+  private AllUsersName allUsersName;
   private ProjectResource oldRsrc;
-  private List<ProjectInfo> children = new ArrayList<>();
-  private Project.NameKey newProjectKey = new Project.NameKey("newProject");
+  private Response<List<ProjectInfo>> children = Response.ok(new ArrayList<>());
+  private Project.NameKey newProjectKey = Project.nameKey("newProject");
 
   @Before
   public void setUp() throws Exception {
+    allProjects = new AllProjectsName(AllProjectsNameProvider.DEFAULT);
+    allUsersName = new AllUsersName(AllUsersNameProvider.DEFAULT);
     oldRsrc = new ProjectResource(control, user);
     when(repoManager.openRepository(newProjectKey)).thenReturn(repo);
     when(repo.getObjectDatabase()).thenReturn(objDb);
@@ -102,13 +107,13 @@
 
   @Test(expected = CannotRenameProjectException.class)
   public void testAssertCannotRenameHasChildren() throws Exception {
-    Project oldProject = new Project(new Project.NameKey("oldProject"));
+    Project oldProject = new Project(Project.nameKey("oldProject"));
     when(oldRsrc.getNameKey()).thenReturn(oldProject.getNameKey());
     when(objDb.exists()).thenReturn(false);
 
     when(listChildProjectsProvider.get()).thenReturn(listChildProjects);
     ProjectInfo projInfo = mock(ProjectInfo.class);
-    children.add(projInfo);
+    children.value().add(projInfo);
     when(listChildProjects.apply(oldRsrc)).thenReturn(children);
 
     preconditions.assertCanRename(oldRsrc, newProjectKey);