Refactor the representation of a collection of package specifications

PiperOrigin-RevId: 175832159
diff --git a/src/test/java/com/google/devtools/build/lib/packages/PackageGroupTest.java b/src/test/java/com/google/devtools/build/lib/packages/PackageGroupTest.java
index 7bb8cae..4c48f0e 100644
--- a/src/test/java/com/google/devtools/build/lib/packages/PackageGroupTest.java
+++ b/src/test/java/com/google/devtools/build/lib/packages/PackageGroupTest.java
@@ -13,6 +13,7 @@
 // limitations under the License.
 package com.google.devtools.build.lib.packages;
 
+import static com.google.common.collect.ImmutableList.toImmutableList;
 import static com.google.common.truth.Truth.assertThat;
 
 import com.google.devtools.build.lib.events.util.EventCollectionApparatus;
@@ -146,8 +147,9 @@
   public void testEverythingSpecificationWorks() throws Exception {
     scratch.file("fruits/BUILD", "package_group(name = 'mango', packages = ['//...'])");
     PackageGroup packageGroup = getPackageGroup("fruits", "mango");
-    assertThat(packageGroup.getPackageSpecifications())
-        .containsExactly(PackageSpecification.everything());
+    assertThat(
+            packageGroup.getPackageSpecifications().containedPackages().collect(toImmutableList()))
+        .containsExactly(PackageSpecification.everything().toString());
   }
 
   private Package getPackage(String packageName) throws Exception {