Fix broken CheckerRefMigrationTest

In [1] injection of AllProjects was replaced with an injection of
AllProjectsNameOnInitProvider since AllProjects was not available on
init.
The fact that the CheckerRefMigrationTest used that constructor was
missed which caused the tests to fail.

Keep the Project.NameKey of All-Projects as member and overload the
constructor so that tests can supply a test controlled Project.NameKey.

[1] 75e72bd - CheckerRefMigration: Use AllProjectsNameOnInitProvider

Bug: Issue 13005
Bug: Issue 12904
Change-Id: I1448c496b3613a07f7d51cba1b46d012c1506d3d
diff --git a/java/com/google/gerrit/plugins/checks/db/CheckerRefMigration.java b/java/com/google/gerrit/plugins/checks/db/CheckerRefMigration.java
index 0ab110a..40eb858 100644
--- a/java/com/google/gerrit/plugins/checks/db/CheckerRefMigration.java
+++ b/java/com/google/gerrit/plugins/checks/db/CheckerRefMigration.java
@@ -13,6 +13,7 @@
 // limitations under the License.
 package com.google.gerrit.plugins.checks.db;
 
+import com.google.common.annotations.VisibleForTesting;
 import com.google.gerrit.entities.Project;
 import com.google.gerrit.pgm.init.api.AllProjectsNameOnInitProvider;
 import com.google.gerrit.plugins.checks.CheckerRef;
@@ -33,17 +34,22 @@
   private static final String LEGACY_REFS_META_CHECKERS = "refs/meta/checkers/";
 
   private final GitRepositoryManager repoManager;
-  private final AllProjectsNameOnInitProvider allProjectsName;
+  private final Project.NameKey allProjectsName;
 
   @Inject
   CheckerRefMigration(
-      GitRepositoryManager repoManager, AllProjectsNameOnInitProvider allProjectsName) {
+      GitRepositoryManager repoManager, AllProjectsNameOnInitProvider allProjectsNameProvider) {
+    this(repoManager, Project.nameKey(allProjectsNameProvider.get()));
+  }
+
+  @VisibleForTesting
+  CheckerRefMigration(GitRepositoryManager repoManager, Project.NameKey allProjectsName) {
     this.repoManager = repoManager;
     this.allProjectsName = allProjectsName;
   }
 
   public void migrate() throws Exception {
-    try (Repository repo = repoManager.openRepository(Project.nameKey(allProjectsName.get()))) {
+    try (Repository repo = repoManager.openRepository(allProjectsName)) {
 
       // This part is specifically for cases where the rename failed half-way last time.
       Ref ref = repo.exactRef(TMP_REF);