### Question:
CollectionReference extends Query { CollectionReference(ResourcePath path, FirebaseFirestore firestore) { super(com.google.firebase.firestore.core.Query.atPath(path), firestore); if (path.length() % 2 != 1) { throw new IllegalArgumentException( "Invalid collection reference. Collection references must have an odd number " + "of segments, but " + path.canonicalString() + " has " + path.length()); } } CollectionReference(ResourcePath path, FirebaseFirestore firestore); @NonNull String getId(); @Nullable DocumentReference getParent(); @NonNull String getPath(); @NonNull DocumentReference document(); @NonNull DocumentReference document(@NonNull String documentPath); @NonNull Task<DocumentReference> add(@NonNull Object data);  }### Answer:
@Test public void testEquals() { CollectionReference foo = TestUtil.collectionReference("foo"); CollectionReference fooDup = TestUtil.collectionReference("foo"); CollectionReference bar = TestUtil.collectionReference("bar"); assertEquals(foo, fooDup); assertNotEquals(foo, bar); assertEquals(foo.hashCode(), fooDup.hashCode()); assertNotEquals(foo.hashCode(), bar.hashCode()); }