@@ -1077,17 +1077,18 @@ public void resumingAQueryShouldUseBloomFilterToAvoidFullRequery() throws Except
1077
1077
}
1078
1078
assertWithMessage ("createdDocuments" ).that (createdDocuments ).hasSize (100 );
1079
1079
1080
- // Delete 50 of the 100 documents. Use a WriteBatch, rather than DocumentReference.delete(),
1081
- // to avoid affecting the local cache.
1080
+ // Delete 50 of the 100 documents. Use a different Firestore instance to avoid affecting the
1081
+ // local cache.
1082
1082
HashSet <String > deletedDocumentIds = new HashSet <>();
1083
1083
{
1084
- WriteBatch writeBatchForDocumentDeletes = collection .getFirestore ().batch ();
1084
+ FirebaseFirestore db2 = testFirestore ();
1085
+ WriteBatch batch = db2 .batch ();
1085
1086
for (int i = 0 ; i < createdDocuments .size (); i += 2 ) {
1086
- DocumentReference documentToDelete = createdDocuments .get (i );
1087
- writeBatchForDocumentDeletes .delete (documentToDelete );
1087
+ DocumentReference documentToDelete = db2 . document ( createdDocuments .get (i ). getPath () );
1088
+ batch .delete (documentToDelete );
1088
1089
deletedDocumentIds .add (documentToDelete .getId ());
1089
1090
}
1090
- waitFor (writeBatchForDocumentDeletes .commit ());
1091
+ waitFor (batch .commit ());
1091
1092
}
1092
1093
assertWithMessage ("deletedDocumentIds" ).that (deletedDocumentIds ).hasSize (50 );
1093
1094
@@ -1236,14 +1237,10 @@ public void bloomFilterShouldCorrectlyEncodeComplexUnicodeCharacters() throws Ex
1236
1237
}
1237
1238
1238
1239
// Delete one of the documents so that the next call to collection.get() will experience an
1239
- // existence filter mismatch. Use a WriteBatch, rather than DocumentReference.delete(), to avoid
1240
- // affecting the local cache.
1240
+ // existence filter mismatch. Use a different Firestore instance to avoid affecting the local
1241
+ // cache.
1241
1242
DocumentReference documentToDelete = collection .document ("DocumentToDelete" );
1242
- {
1243
- WriteBatch writeBatchForDocumentDeletes = collection .getFirestore ().batch ();
1244
- writeBatchForDocumentDeletes .delete (documentToDelete );
1245
- waitFor (writeBatchForDocumentDeletes .commit ());
1246
- }
1243
+ waitFor (testFirestore ().document (documentToDelete .getPath ()).delete ());
1247
1244
1248
1245
// Wait for 10 seconds, during which Watch will stop tracking the query and will send an
1249
1246
// existence filter rather than "delete" events when the query is resumed.
0 commit comments