diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/FirestoreSpy.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/FirestoreSpy.java index d987aaffc..690de890e 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/FirestoreSpy.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/FirestoreSpy.java @@ -33,7 +33,8 @@ public final class FirestoreSpy { streamRequestBidiStreamObserverCaptor; public FirestoreSpy(Firestore firestore) { - spy = Mockito.spy((FirestoreImpl) firestore); + final FirestoreImpl firestoreImpl = (FirestoreImpl) firestore; + spy = Mockito.spy(firestoreImpl); streamRequestBidiStreamObserverCaptor = ArgumentCaptor.forClass(BidiStreamObserver.class); doCallRealMethod() .when(spy) diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/it/ITQueryWatchTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/it/ITQueryWatchTest.java index 2fecdd30a..00341372d 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/it/ITQueryWatchTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/it/ITQueryWatchTest.java @@ -382,10 +382,12 @@ public void restartAfterFailedFilter() throws Exception { .modifiedIdsIsEmpty() .removedIdsIsEmpty(); listener.lastDocumentIdsIsAnyOf("doc1", "doc2"); - BidiStreamObserver watch = - firestoreSpy.streamRequestBidiStreamObserverCaptor.getValue(); // Trigger existence filter mismatch, thereby invoking retry behavior. + // Prompting Firestore to send filter mismatch is difficult, so we hack + // in the response. All we are concerned about is invoking retry. + BidiStreamObserver watch = + firestoreSpy.streamRequestBidiStreamObserverCaptor.getValue(); watch.onResponse(filter(0)); setDocument("doc3", map("foo", "bar"));