Skip to content

Commit 9f9f95a

Browse files
committed
small refactor
1 parent 385d3cf commit 9f9f95a

File tree

1 file changed

+18
-30
lines changed

1 file changed

+18
-30
lines changed

firebase-firestore/src/androidTest/java/com/google/firebase/firestore/QueryToPipelineTest.java

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -613,53 +613,41 @@ public void testQueriesCanUseArrayContainsAnyFilters() {
613613
FirebaseFirestore db = collection.firestore;
614614

615615
// Search for "array" to contain [42, 43].
616-
PipelineSnapshot snapshot =
617-
waitFor(
618-
db.pipeline()
619-
.convertFrom(collection.whereArrayContainsAny("array", asList(42L, 43L)))
620-
.execute());
616+
Pipeline pipeline = db.pipeline()
617+
.convertFrom(collection.whereArrayContainsAny("array", asList(42L, 43L)));
618+
PipelineSnapshot snapshot = waitFor(pipeline.execute());
621619
assertEquals(asList(docA, docB, docD, docE), pipelineSnapshotToValues(snapshot));
622620

623621
// With objects.
624-
snapshot =
625-
waitFor(
626-
db.pipeline()
627-
.convertFrom(collection.whereArrayContainsAny("array", asList(map("a", 42L))))
628-
.execute());
622+
pipeline = db.pipeline()
623+
.convertFrom(collection.whereArrayContainsAny("array", asList(map("a", 42L))));
624+
snapshot = waitFor(pipeline.execute());
629625
assertEquals(asList(docF), pipelineSnapshotToValues(snapshot));
630626

631627
// With null.
632-
snapshot =
633-
waitFor(
634-
db.pipeline()
635-
.convertFrom(collection.whereArrayContainsAny("array", nullList()))
636-
.execute());
628+
pipeline = db.pipeline()
629+
.convertFrom(collection.whereArrayContainsAny("array", nullList()));
630+
snapshot = waitFor(pipeline.execute());
637631
assertEquals(new ArrayList<>(), pipelineSnapshotToValues(snapshot));
638632

639633
// With null and a value.
640634
List<Object> inputList = nullList();
641635
inputList.add(43L);
642-
snapshot =
643-
waitFor(
644-
db.pipeline()
645-
.convertFrom(collection.whereArrayContainsAny("array", inputList))
646-
.execute());
636+
pipeline = db.pipeline()
637+
.convertFrom(collection.whereArrayContainsAny("array", inputList));
638+
snapshot = waitFor(pipeline.execute());
647639
assertEquals(asList(docE), pipelineSnapshotToValues(snapshot));
648640

649641
// With NaN.
650-
snapshot =
651-
waitFor(
652-
db.pipeline()
653-
.convertFrom(collection.whereArrayContainsAny("array", asList(Double.NaN)))
654-
.execute());
642+
pipeline = db.pipeline()
643+
.convertFrom(collection.whereArrayContainsAny("array", asList(Double.NaN)));
644+
snapshot = waitFor(pipeline.execute());
655645
assertEquals(new ArrayList<>(), pipelineSnapshotToValues(snapshot));
656646

657647
// With NaN and a value.
658-
snapshot =
659-
waitFor(
660-
db.pipeline()
661-
.convertFrom(collection.whereArrayContainsAny("array", asList(Double.NaN, 43L)))
662-
.execute());
648+
pipeline = db.pipeline()
649+
.convertFrom(collection.whereArrayContainsAny("array", asList(Double.NaN, 43L)));
650+
snapshot = waitFor(pipeline.execute());
663651
assertEquals(asList(docE), pipelineSnapshotToValues(snapshot));
664652
}
665653

0 commit comments

Comments
 (0)