Return empty list when prefix is not matched in suggest

Prior to this fix the code was returning a GroupReference with
a `null` group UUID when no matches were found for the prefix.

Having a `null` UUID can cause NPE later on in the code.

Issue: Bug 16571
Change-Id: I414154c50dc0530dad817f1a8291c6bf0ecd7a35
(cherry picked from commit 34f2b6a4a6e591d7ea23dcc46d0402beeee70f9f)
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/auth/PullReplicationGroupBackend.java b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/auth/PullReplicationGroupBackend.java
index 2492c81..ffd3c1f 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/auth/PullReplicationGroupBackend.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/auth/PullReplicationGroupBackend.java
@@ -27,6 +27,8 @@
 import com.google.inject.Singleton;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
 
 /** Backend to expose the pull-replication internal user group membership. */
 @Singleton
@@ -81,10 +83,9 @@
 
   @Override
   public Collection<GroupReference> suggest(String name, ProjectState project) {
-    return Arrays.asList(
-        NAME_PREFIX.contains(name.toLowerCase())
-            ? GroupReference.create(INTERNAL_GROUP_UUID, INTERNAL_GROUP_NAME)
-            : GroupReference.create(name));
+    return NAME_PREFIX.contains(name.toLowerCase())
+        ? List.of(GroupReference.create(INTERNAL_GROUP_UUID, INTERNAL_GROUP_NAME))
+        : Collections.emptyList();
   }
 
   @Override
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/auth/PullReplicationGroupBackendIT.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/auth/PullReplicationGroupBackendIT.java
index 87738e3..df7da98 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/auth/PullReplicationGroupBackendIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/auth/PullReplicationGroupBackendIT.java
@@ -58,6 +58,13 @@
   }
 
   @Test
+  public void shouldSuggestEmptyListIfNameNotMatched() {
+    Collection<GroupReference> groups = groupBackend.suggest("nonMatchablePrefix", null);
+
+    assertThat(groups).isEmpty();
+  }
+
+  @Test
   public void pullReplicationInternalUserShouldHaveMembershipOfInternalGroupAndAnonymousUsers() {
     assertMemberOfInternalAndAnonymousUsers(
         groupBackend.membershipsOf(getPullReplicationInternalUser()));