From ddf4733f86736759cbcaabeaccdf50841b4734d9 Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Fri, 23 Jun 2023 10:32:36 -0400 Subject: [PATCH 1/3] mockito 4 --- google-cloud-firestore/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/google-cloud-firestore/pom.xml b/google-cloud-firestore/pom.xml index 2fde07ac17..ddead074a0 100644 --- a/google-cloud-firestore/pom.xml +++ b/google-cloud-firestore/pom.xml @@ -131,8 +131,8 @@ org.mockito - mockito-all - 1.10.19 + mockito-core + 4.11.0 test From e53fd90a2d341f390fbc0eca9154240fe0c13881 Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Fri, 23 Jun 2023 10:42:54 -0400 Subject: [PATCH 2/3] Replaced old class with new class --- .../firestore/AggregateQuerySnapshotTest.java | 2 +- .../cloud/firestore/AggregateQueryTest.java | 2 +- .../cloud/firestore/BulkWriterTest.java | 18 ++--- .../firestore/CollectionReferenceTest.java | 6 +- .../cloud/firestore/ConformanceTest.java | 18 ++--- .../firestore/DocumentReferenceTest.java | 74 ++++++++--------- .../cloud/firestore/FirestoreBundleTest.java | 2 +- .../google/cloud/firestore/FirestoreTest.java | 14 ++-- .../cloud/firestore/LocalFirestoreHelper.java | 4 +- .../google/cloud/firestore/MapperTest.java | 2 +- .../cloud/firestore/PartitionQuery.java | 12 +-- .../cloud/firestore/QueryCountTest.java | 34 ++++---- .../com/google/cloud/firestore/QueryTest.java | 80 +++++++++---------- .../cloud/firestore/RateLimiterTest.java | 2 +- .../cloud/firestore/RecursiveDeleteTest.java | 32 ++++---- .../google/cloud/firestore/ToStringTest.java | 2 +- .../cloud/firestore/TransactionTest.java | 58 +++++++------- .../com/google/cloud/firestore/WatchTest.java | 6 +- .../cloud/firestore/WriteBatchTest.java | 24 +++--- 19 files changed, 196 insertions(+), 196 deletions(-) diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/AggregateQuerySnapshotTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/AggregateQuerySnapshotTest.java index d500cad2f9..a7f5864285 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/AggregateQuerySnapshotTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/AggregateQuerySnapshotTest.java @@ -23,7 +23,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class AggregateQuerySnapshotTest { diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/AggregateQueryTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/AggregateQueryTest.java index e8baa9e0d8..d7e5134740 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/AggregateQueryTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/AggregateQueryTest.java @@ -23,7 +23,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class AggregateQueryTest { diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/BulkWriterTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/BulkWriterTest.java index 202809188b..60099af836 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/BulkWriterTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/BulkWriterTest.java @@ -66,10 +66,10 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mockito; import org.mockito.Spy; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class BulkWriterTest { @@ -1011,7 +1011,7 @@ public void flushSucceedsEvenIfBulkCommitFails() throws Exception { .when(firestoreMock) .sendRequest( batchWriteCapture.capture(), - Matchers.>any()); + ArgumentMatchers.>any()); bulkWriter.set(doc1, LocalFirestoreHelper.SINGLE_FIELD_MAP); bulkWriter.set(doc2, LocalFirestoreHelper.SINGLE_FIELD_MAP); bulkWriter.flush().get(); @@ -1023,7 +1023,7 @@ public void closeSucceedsEvenIfBulkCommitFails() throws Exception { .when(firestoreMock) .sendRequest( batchWriteCapture.capture(), - Matchers.>any()); + ArgumentMatchers.>any()); bulkWriter.set(doc1, LocalFirestoreHelper.SINGLE_FIELD_MAP); bulkWriter.set(doc2, LocalFirestoreHelper.SINGLE_FIELD_MAP); bulkWriter.close(); @@ -1035,7 +1035,7 @@ public void individualWritesErrorIfBulkCommitFails() throws Exception { .when(firestoreMock) .sendRequest( batchWriteCapture.capture(), - Matchers.>any()); + ArgumentMatchers.>any()); int opCount = 0; ApiFuture result1 = bulkWriter.set(doc1, LocalFirestoreHelper.SINGLE_FIELD_MAP); ApiFuture result2 = bulkWriter.set(doc2, LocalFirestoreHelper.SINGLE_FIELD_MAP); @@ -1058,7 +1058,7 @@ public void individualWritesErrorIfBulkCommitFailsWithNonFirestoreException() th .when(firestoreMock) .sendRequest( batchWriteCapture.capture(), - Matchers.>any()); + ArgumentMatchers.>any()); int opCount = 0; ApiFuture result1 = bulkWriter.set(doc1, LocalFirestoreHelper.SINGLE_FIELD_MAP); ApiFuture result2 = bulkWriter.set(doc2, LocalFirestoreHelper.SINGLE_FIELD_MAP); @@ -1086,7 +1086,7 @@ public void retriesWritesWhenBatchWriteFailsWithRetryableError() throws Exceptio .when(firestoreMock) .sendRequest( batchWriteCapture.capture(), - Matchers.>any()); + ArgumentMatchers.>any()); ApiFuture result = bulkWriter.set(doc1, LocalFirestoreHelper.SINGLE_FIELD_MAP); bulkWriter.close(); @@ -1125,7 +1125,7 @@ public ScheduledFuture schedule(Runnable command, long delay, TimeUnit unit) .when(firestoreMock) .sendRequest( batchWriteCapture.capture(), - Matchers.>any()); + ArgumentMatchers.>any()); bulkWriter = firestoreMock.bulkWriter(BulkWriterOptions.builder().setExecutor(timeoutExecutor).build()); @@ -1175,7 +1175,7 @@ public ScheduledFuture schedule(Runnable command, long delay, TimeUnit unit) .when(firestoreMock) .sendRequest( batchWriteCapture.capture(), - Matchers.>any()); + ArgumentMatchers.>any()); bulkWriter = firestoreMock.bulkWriter(BulkWriterOptions.builder().setExecutor(timeoutExecutor).build()); diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/CollectionReferenceTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/CollectionReferenceTest.java index 0ede445461..397468d7a4 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/CollectionReferenceTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/CollectionReferenceTest.java @@ -32,10 +32,10 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mockito; import org.mockito.Spy; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class CollectionReferenceTest { @@ -94,7 +94,7 @@ public void addDocument() throws Exception { doReturn(LocalFirestoreHelper.SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - argCaptor.capture(), Matchers.>any()); + argCaptor.capture(), ArgumentMatchers.>any()); ApiFuture future = collectionReference.add(LocalFirestoreHelper.SINGLE_FIELD_MAP); diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/ConformanceTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/ConformanceTest.java index dd5b215950..f31ea807e8 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/ConformanceTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/ConformanceTest.java @@ -87,7 +87,7 @@ import org.junit.runners.AllTests; import org.mockito.ArgumentCaptor; import org.mockito.Captor; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; @@ -264,7 +264,7 @@ public void runTest() throws Throwable { .streamRequest( getAllCapture.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); document(testParameters.getDocRefPath()).get().get(); @@ -288,7 +288,7 @@ private ConformanceCreateTestRunner(String description, CreateTest testParameter public void runTest() { doReturn(commitResponse(testParameters.getRequest().getWritesCount(), 0)) .when(firestore) - .sendRequest(commitCapture.capture(), Matchers.>any()); + .sendRequest(commitCapture.capture(), ArgumentMatchers.>any()); try { ApiFuture apiCall = @@ -319,7 +319,7 @@ private ConformanceSetTestRunner(String description, SetTest testParameters) { public void runTest() { doReturn(commitResponse(testParameters.getRequest().getWritesCount(), 0)) .when(firestore) - .sendRequest(commitCapture.capture(), Matchers.>any()); + .sendRequest(commitCapture.capture(), ArgumentMatchers.>any()); ApiFuture apiCall; try { @@ -364,7 +364,7 @@ private ConformanceUpdateTestRunner(String description, UpdateTest testParameter public void runTest() { doReturn(commitResponse(testParameters.getRequest().getWritesCount(), 0)) .when(firestore) - .sendRequest(commitCapture.capture(), Matchers.>any()); + .sendRequest(commitCapture.capture(), ArgumentMatchers.>any()); try { ApiFuture apiCall; @@ -405,7 +405,7 @@ private ConformanceUpdatePathsTestRunner(String description, UpdatePathsTest tes public void runTest() { doReturn(commitResponse(testParameters.getRequest().getWritesCount(), 0)) .when(firestore) - .sendRequest(commitCapture.capture(), Matchers.>any()); + .sendRequest(commitCapture.capture(), ArgumentMatchers.>any()); try { ApiFuture apiCall; @@ -461,7 +461,7 @@ private ConformanceDeleteTestRunner(String description, DeleteTest testParameter public void runTest() throws Throwable { doReturn(commitResponse(0, testParameters.getRequest().getWritesCount())) .when(firestore) - .sendRequest(commitCapture.capture(), Matchers.>any()); + .sendRequest(commitCapture.capture(), ArgumentMatchers.>any()); if (!testParameters.hasPrecondition()) { document(testParameters.getDocRefPath()).delete().get(); @@ -494,7 +494,7 @@ public void runTest() { .streamRequest( runQueryCapture.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); Query query = collection(testParameters.getCollPath()); @@ -647,7 +647,7 @@ public void runTest() throws Throwable { }) .when(firestore) .streamRequest( - streamObserverCapture.capture(), Matchers.any(BidiStreamingCallable.class)); + streamObserverCapture.capture(), ArgumentMatchers.any(BidiStreamingCallable.class)); final List expectedSnapshots = new ArrayList<>(testParameters.getSnapshotsList()); diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/DocumentReferenceTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/DocumentReferenceTest.java index aecc8b6bea..dab431fac2 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/DocumentReferenceTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/DocumentReferenceTest.java @@ -93,10 +93,10 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mockito; import org.mockito.Spy; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class DocumentReferenceTest { @@ -149,7 +149,7 @@ public void serializeBasicTypes() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); documentReference.set(ALL_SUPPORTED_TYPES_MAP).get(); documentReference.set(ALL_SUPPORTED_TYPES_OBJECT).get(); @@ -164,7 +164,7 @@ public void serializeDocumentReference() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); documentReference.set(map("docRef", documentReference)).get(); @@ -214,7 +214,7 @@ public void deserializeBasicTypes() throws Exception { .streamRequest( getAllCapture.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); DocumentSnapshot snapshot = documentReference.get().get(); assertEquals(snapshot.getData(), ALL_SUPPORTED_TYPES_MAP); @@ -271,7 +271,7 @@ public void deserializeDocumentReference() throws Exception { .streamRequest( getAllCapture.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); DocumentSnapshot snapshot = documentReference.get().get(); assertEquals(documentReference, snapshot.getData().get("docRef")); @@ -285,7 +285,7 @@ public void getFieldWithFieldMask() throws Exception { .streamRequest( getAllCapture.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); DocumentSnapshot snapshot = documentReference.get(FieldMask.of(FieldPath.of("foo"))).get(); assertEquals("foo", getAllCapture.getValue().getMask().getFieldPaths(0)); assertEquals("bar", snapshot.get("foo")); @@ -298,7 +298,7 @@ public void deserializesDates() throws Exception { .streamRequest( getAllCapture.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); DocumentSnapshot snapshot = documentReference.get().get(); @@ -323,7 +323,7 @@ public void doesNotDeserializeAdvancedNumberTypes() throws Exception { .streamRequest( getAllCapture.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); DocumentSnapshot snapshot = documentReference.get().get(); try { @@ -355,7 +355,7 @@ public void notFound() throws Exception { .streamRequest( getAllCapture.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); DocumentSnapshot snapshot = documentReference.get().get(); assertEquals(documentReference, snapshot.getReference()); @@ -369,7 +369,7 @@ public void deleteDocument() throws Exception { doReturn(SINGLE_DELETE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); documentReference.delete().get(); documentReference @@ -390,7 +390,7 @@ public void createDocument() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); documentReference.create(SINGLE_FIELD_MAP).get(); documentReference.create(SINGLE_FIELD_OBJECT).get(); @@ -407,7 +407,7 @@ public void createWithServerTimestamp() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); documentReference.create(LocalFirestoreHelper.SERVER_TIMESTAMP_MAP).get(); documentReference.create(LocalFirestoreHelper.SERVER_TIMESTAMP_OBJECT).get(); @@ -427,7 +427,7 @@ public void setWithServerTimestamp() throws Exception { doReturn(FIELD_TRANSFORM_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); documentReference.set(LocalFirestoreHelper.SERVER_TIMESTAMP_MAP).get(); documentReference.set(LocalFirestoreHelper.SERVER_TIMESTAMP_OBJECT).get(); @@ -447,7 +447,7 @@ public void updateWithServerTimestamp() throws Exception { doReturn(FIELD_TRANSFORM_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); documentReference.update(LocalFirestoreHelper.SERVER_TIMESTAMP_MAP).get(); @@ -474,7 +474,7 @@ public void mergeWithServerTimestamps() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); documentReference .set(LocalFirestoreHelper.SERVER_TIMESTAMP_MAP, SetOptions.mergeFields("inner.bar")) @@ -498,7 +498,7 @@ public void setWithIncrement() throws Exception { doReturn(FIELD_TRANSFORM_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); documentReference .set(map("integer", FieldValue.increment(1), "double", FieldValue.increment(1.1))) @@ -522,7 +522,7 @@ public void setWithArrayUnion() throws Exception { doReturn(FIELD_TRANSFORM_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); documentReference.set(map("foo", FieldValue.arrayUnion("bar", map("foo", "baz")))).get(); @@ -540,7 +540,7 @@ public void setWithArrayRemove() throws Exception { doReturn(FIELD_TRANSFORM_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); documentReference.set(map("foo", FieldValue.arrayRemove("bar", map("foo", "baz")))).get(); @@ -688,7 +688,7 @@ public void setDocumentWithMerge() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); documentReference.set(SINGLE_FIELD_MAP, SetOptions.merge()).get(); documentReference.set(SINGLE_FIELD_OBJECT, SetOptions.merge()).get(); @@ -714,7 +714,7 @@ public void setDocumentWithEmptyMerge() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); documentReference.set(map(), SetOptions.merge()).get(); @@ -727,7 +727,7 @@ public void setDocumentWithNestedMerge() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); documentReference.set(NESTED_CLASS_OBJECT, SetOptions.mergeFields("first.foo")).get(); documentReference @@ -756,7 +756,7 @@ public void setMultipleFieldsWithMerge() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); documentReference .set( @@ -784,7 +784,7 @@ public void setNestedMapWithMerge() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); documentReference.set(NESTED_CLASS_OBJECT, SetOptions.mergeFields("first", "second")).get(); @@ -804,7 +804,7 @@ public void mergeWithDotsInFieldName() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); documentReference .set( @@ -828,7 +828,7 @@ public void extractFieldMaskFromMerge() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); documentReference.set(NESTED_CLASS_OBJECT, SetOptions.merge()).get(); @@ -868,7 +868,7 @@ public void updateDocument() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); documentReference.update(SINGLE_FIELD_MAP); documentReference.update("foo", "bar").get(); @@ -886,7 +886,7 @@ public void updateWithDotsInFieldName() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); documentReference.update(map("a.b.c", map("d.e", "foo"))).get(); @@ -910,7 +910,7 @@ public void updateNestedMap() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); documentReference.update("a.b", "foo", "a.c", FieldValue.delete()).get(); @@ -961,7 +961,7 @@ public void deleteField() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); documentReference.update("foo", "bar", "bar.foo", FieldValue.delete()).get(); @@ -981,7 +981,7 @@ public void updateNestedDocument() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); Map nestedObject = new HashMap<>(); nestedObject.put("a", "b"); @@ -1005,7 +1005,7 @@ public void updateDocumentWithTwoFields() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); documentReference.update("a", "b", "c", "d").get(); @@ -1027,7 +1027,7 @@ public void updateDocumentWithPreconditions() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); Precondition options = Precondition.updatedAt(Timestamp.ofTimeSecondsAndNanos(479978400, 123000000)); @@ -1052,7 +1052,7 @@ public void updateIndividualPojo() throws ExecutionException, InterruptedExcepti doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); documentReference.update(UPDATED_POJO); documentReference.update(UPDATED_POJO).get(); CommitRequest expectedCommit = @@ -1068,7 +1068,7 @@ public void deleteNestedFieldUsingFieldPath() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); FieldPath path = FieldPath.of("a.b", "c.d"); documentReference.update(path, FieldValue.delete()).get(); CommitRequest expectedCommit = @@ -1097,7 +1097,7 @@ public void deserializeCustomList() throws ExecutionException, InterruptedExcept .streamRequest( getAllCapture.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); DocumentSnapshot snapshot = documentReference.get().get(); LocalFirestoreHelper.CustomList customList = snapshot.toObject(LocalFirestoreHelper.CustomList.class); @@ -1129,7 +1129,7 @@ public void deserializeCustomMap() throws ExecutionException, InterruptedExcepti .streamRequest( getAllCapture.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); DocumentSnapshot snapshot = documentReference.get().get(); LocalFirestoreHelper.CustomMap customMap = snapshot.toObject(LocalFirestoreHelper.CustomMap.class); diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/FirestoreBundleTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/FirestoreBundleTest.java index 28ff1d7105..780bbd6981 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/FirestoreBundleTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/FirestoreBundleTest.java @@ -46,7 +46,7 @@ import org.junit.runner.RunWith; import org.mockito.Mockito; import org.mockito.Spy; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class FirestoreBundleTest { diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/FirestoreTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/FirestoreTest.java index 9d685022d9..281a8a37a9 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/FirestoreTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/FirestoreTest.java @@ -48,10 +48,10 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mockito; import org.mockito.Spy; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class FirestoreTest { @@ -85,7 +85,7 @@ public void illegalFieldPath() throws Exception { .streamRequest( getAllCapture.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); DocumentReference doc = firestoreMock.document("coll/doc"); DocumentSnapshot snapshot = doc.get().get(); @@ -116,7 +116,7 @@ public void getAll() throws Exception { .streamRequest( getAllCapture.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); DocumentReference doc1 = firestoreMock.document("coll/doc1"); DocumentReference doc2 = firestoreMock.document("coll/doc2"); @@ -137,7 +137,7 @@ public void getAllWithFieldMask() throws Exception { .streamRequest( getAllCapture.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); DocumentReference doc1 = firestoreMock.document("coll/doc1"); FieldMask fieldMask = FieldMask.of(FieldPath.of("foo", "bar")); @@ -190,7 +190,7 @@ public void arrayUnionWithPojo() throws ExecutionException, InterruptedException doReturn(commitResponse(1, 0)) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); DocumentReference doc = firestoreMock.document("coll/doc"); doc.update("array", FieldValue.arrayUnion(SINGLE_FIELD_OBJECT)).get(); @@ -208,7 +208,7 @@ public void arrayRemoveWithPojo() throws ExecutionException, InterruptedExceptio doReturn(commitResponse(1, 0)) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); DocumentReference doc = firestoreMock.document("coll/doc"); doc.update("array", FieldValue.arrayRemove(SINGLE_FIELD_OBJECT)).get(); diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/LocalFirestoreHelper.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/LocalFirestoreHelper.java index b3774224e4..56632c1538 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/LocalFirestoreHelper.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/LocalFirestoreHelper.java @@ -86,7 +86,7 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Nullable; import org.mockito.ArgumentCaptor; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.stubbing.Answer; import org.mockito.stubbing.Stubber; import org.threeten.bp.Duration; @@ -1203,7 +1203,7 @@ void initializeStub( Preconditions.checkNotNull(stubber, "Stubber should not be null"); stubber .when(firestoreMock) - .sendRequest(argumentCaptor.capture(), Matchers.>any()); + .sendRequest(argumentCaptor.capture(), ArgumentMatchers.>any()); } public void verifyAllRequestsSent() { diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/MapperTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/MapperTest.java index e3725127e0..5324fa855c 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/MapperTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/MapperTest.java @@ -48,7 +48,7 @@ import org.junit.runner.RunWith; import org.mockito.Mockito; import org.mockito.Spy; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @SuppressWarnings({"unused", "WeakerAccess", "SpellCheckingInspection"}) @RunWith(MockitoJUnitRunner.class) diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/PartitionQuery.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/PartitionQuery.java index 04203313be..e4a3af593a 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/PartitionQuery.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/PartitionQuery.java @@ -44,11 +44,11 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.Spy; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class PartitionQuery { @@ -109,7 +109,7 @@ public void requestsOneLessThanDesired() throws Exception { .when(firestoreMock) .sendRequest( requestCaptor.capture(), - Matchers.>any()); + ArgumentMatchers.>any()); firestoreMock.collectionGroup("collectionId").getPartitions(desiredPartitionsCount).get(); @@ -153,14 +153,14 @@ public void convertsPartitionsToQueries() throws Exception { .when(firestoreMock) .sendRequest( requestCaptor.capture(), - Matchers.>any()); + ArgumentMatchers.>any()); doAnswer(queryResponse()) .when(firestoreMock) .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); List partitions = firestoreMock.collectionGroup("collectionId").getPartitions(desiredPartitionsCount).get(); @@ -193,7 +193,7 @@ public void sortsPartitions() throws Exception { .when(firestoreMock) .sendRequest( requestCaptor.capture(), - Matchers.>any()); + ArgumentMatchers.>any()); List partitions = firestoreMock.collectionGroup("collectionId").getPartitions(desiredPartitionsCount).get(); diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/QueryCountTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/QueryCountTest.java index ea9dad975f..f4f3063258 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/QueryCountTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/QueryCountTest.java @@ -49,9 +49,9 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Spy; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.threeten.bp.Duration; @RunWith(MockitoJUnitRunner.class) @@ -83,7 +83,7 @@ public void countShouldBeZeroForEmptyCollection() throws Exception { .streamRequest( runAggregationQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); AggregateQuerySnapshot snapshot = query.count().get().get(); @@ -97,7 +97,7 @@ public void countShouldBe99ForCollectionWith99Documents() throws Exception { .streamRequest( runAggregationQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); AggregateQuerySnapshot snapshot = query.count().get().get(); @@ -111,7 +111,7 @@ public void countShouldMakeCorrectRequestForACollection() throws Exception { .streamRequest( runAggregationQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); CollectionReference collection = firestoreMock.collection(COLLECTION_ID); collection.count().get(); @@ -126,7 +126,7 @@ public void countShouldMakeCorrectRequestForAComplexQuery() throws Exception { .streamRequest( runAggregationQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); query.orderBy("foo").startAt("foo").endAt("bar").limitToLast(42).count().get().get(); @@ -147,7 +147,7 @@ public void shouldReturnReadTimeFromResponse() throws Exception { .streamRequest( runAggregationQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); AggregateQuerySnapshot snapshot = query.count().get().get(); @@ -161,7 +161,7 @@ public void shouldIgnoreExtraRunAggregationQueryResponses() throws Exception { .streamRequest( runAggregationQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); AggregateQuerySnapshot snapshot = query.count().get().get(); @@ -175,7 +175,7 @@ public void shouldIgnoreExtraErrors() throws Exception { .streamRequest( runAggregationQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); AggregateQuerySnapshot snapshot = query.count().get().get(); @@ -190,7 +190,7 @@ public void shouldPropagateErrors() throws Exception { .streamRequest( runAggregationQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); ApiFuture future = query.count().get(); ExecutionException executionException = assertThrows(ExecutionException.class, future::get); @@ -210,7 +210,7 @@ public void aggregateQuerySnapshotGetQueryShouldReturnCorrectValue() throws Exce .streamRequest( runAggregationQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); AggregateQuery aggregateQuery = query.count(); AggregateQuerySnapshot snapshot = aggregateQuery.get().get(); @@ -226,7 +226,7 @@ public void shouldNotRetryIfExceptionIsNotFirestoreException() { .streamRequest( runAggregationQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); ApiFuture future = query.count().get(); @@ -241,7 +241,7 @@ public void shouldRetryIfExceptionIsFirestoreExceptionWithRetryableStatus() thro .streamRequest( runAggregationQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); ApiFuture future = query.count().get(); AggregateQuerySnapshot snapshot = future.get(); @@ -258,7 +258,7 @@ public void shouldNotRetryIfExceptionIsFirestoreExceptionWithNonRetryableStatus( .streamRequest( runAggregationQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); ApiFuture future = query.count().get(); @@ -276,7 +276,7 @@ public void shouldNotRetryIfExceptionIsFirestoreExceptionWithNonRetryableStatus( .streamRequest( runAggregationQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); ApiFuture future = query.count().get(); AggregateQuerySnapshot snapshot = future.get(); @@ -294,7 +294,7 @@ public void shouldRetryIfExceptionIsFirestoreExceptionWithRetryableStatusWithinT .streamRequest( runAggregationQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); ApiFuture future = query.count().get(); AggregateQuerySnapshot snapshot = future.get(); @@ -319,7 +319,7 @@ public void shouldRetryIfExceptionIsFirestoreExceptionWithRetryableStatusWithinT .streamRequest( runAggregationQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); ApiFuture future = query.count().get(); diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/QueryTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/QueryTest.java index f1591c400f..1fa92fc242 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/QueryTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/QueryTest.java @@ -77,10 +77,10 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mockito; import org.mockito.Spy; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.threeten.bp.Duration; @RunWith(MockitoJUnitRunner.class) @@ -134,7 +134,7 @@ public void withLimit() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); query.limit(42).get().get(); @@ -148,7 +148,7 @@ public void limitToLastReversesOrderingConstraints() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); query.orderBy("foo").limitToLast(42).get().get(); @@ -163,7 +163,7 @@ public void limitToLastReversesCursors() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); query.orderBy("foo").startAt("foo").endAt("bar").limitToLast(42).get().get(); @@ -183,7 +183,7 @@ public void limitToLastReversesResults() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); QuerySnapshot querySnapshot = query.orderBy("foo").limitToLast(2).get().get(); @@ -199,7 +199,7 @@ public void limitToLastRequiresAtLeastOneOrderingConstraint() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); try { query.limitToLast(1).get().get(); @@ -218,7 +218,7 @@ public void limitToLastRejectsStream() { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); try { query.orderBy("foo").limitToLast(1).stream(null); @@ -238,7 +238,7 @@ public void withOffset() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); query.offset(42).get().get(); @@ -252,7 +252,7 @@ public void withFilter() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); query.whereEqualTo("foo", "bar").get().get(); query.whereEqualTo("foo", null).get().get(); @@ -303,7 +303,7 @@ public void withFieldPathFilter() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); query.whereEqualTo(FieldPath.of("foo"), "bar").get().get(); query.whereNotEqualTo(FieldPath.of("foo"), "bar").get().get(); @@ -342,7 +342,7 @@ public void withCompositeFilter() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); // a == 10 && (b==20 || c==30 || (d==40 && e>50) || f==60) query @@ -378,7 +378,7 @@ public void inQueriesWithReferenceArray() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); query .whereIn(FieldPath.documentId(), Arrays.asList("doc", firestoreMock.document("coll/doc"))) @@ -405,7 +405,7 @@ public void inQueriesFieldsNotUsedInOrderBy() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); // Field "foo" used in `whereIn` should not appear in implicit orderBys in the resulting query. query @@ -459,7 +459,7 @@ public void notInQueriesWithReferenceArray() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); query .whereNotIn( @@ -529,7 +529,7 @@ public void withDocumentIdFilter() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); query.whereEqualTo(FieldPath.documentId(), "doc").get().get(); @@ -546,7 +546,7 @@ public void withOrderBy() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); query.orderBy("foo").orderBy("foo.bar", Query.Direction.DESCENDING).get().get(); @@ -564,7 +564,7 @@ public void withFieldPathOrderBy() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); query .orderBy(FieldPath.of("foo")) @@ -586,7 +586,7 @@ public void withSelect() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); query.select(new String[] {}).get().get(); query.select("foo", "foo.bar").get().get(); @@ -608,7 +608,7 @@ public void withFieldPathSelect() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); query.select(new FieldPath[] {}).get().get(); query.select(FieldPath.of("foo"), FieldPath.of("foo", "bar")).get().get(); @@ -630,7 +630,7 @@ public void withDocumentSnapshotCursor() { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); query.startAt(SINGLE_FIELD_SNAPSHOT).get(); @@ -651,7 +651,7 @@ public void withDocumentIdAndDocumentSnapshotCursor() { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); query.orderBy(FieldPath.documentId()).startAt(SINGLE_FIELD_SNAPSHOT).get(); @@ -672,7 +672,7 @@ public void withDocumentReferenceCursor() { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); DocumentReference documentCursor = firestoreMock.document(DOCUMENT_PATH); Value documentValue = reference(DOCUMENT_NAME); @@ -692,7 +692,7 @@ public void withExtractedDirectionForDocumentSnapshotCursor() { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); query.orderBy("foo", Query.Direction.DESCENDING).startAt(SINGLE_FIELD_SNAPSHOT).get(); @@ -715,7 +715,7 @@ public void withInequalityFilterForDocumentSnapshotCursor() { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); query .whereEqualTo("a", "b") @@ -746,7 +746,7 @@ public void withEqualityFilterForDocumentSnapshotCursor() { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); query.whereEqualTo("foo", "bar").startAt(SINGLE_FIELD_SNAPSHOT).get(); @@ -768,7 +768,7 @@ public void withStartAt() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); query.orderBy("foo").orderBy(FieldPath.documentId()).startAt("bar", "doc").get().get(); @@ -822,7 +822,7 @@ public void withStartAfter() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); query.orderBy("foo").startAfter("bar").get().get(); @@ -839,7 +839,7 @@ public void withEndBefore() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); query.orderBy("foo").endBefore("bar").get().get(); @@ -856,7 +856,7 @@ public void withEndAt() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); query.orderBy("foo").endAt("bar").get().get(); @@ -873,7 +873,7 @@ public void withCollectionGroup() { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); Query query = firestoreMock.collectionGroup(COLLECTION_ID); query = query.whereGreaterThan(FieldPath.documentId(), "coll/doc"); @@ -920,7 +920,7 @@ public void getResult() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); QuerySnapshot result = query.get().get(); @@ -968,7 +968,7 @@ public void streamResult() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); final Semaphore semaphore = new Semaphore(0); final Iterator iterator = Arrays.asList("doc1", "doc2").iterator(); @@ -1003,7 +1003,7 @@ public void successfulReturnWithoutOnComplete() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); final Semaphore semaphore = new Semaphore(0); final Iterator iterator = Arrays.asList("doc1", "doc2").iterator(); @@ -1042,7 +1042,7 @@ public void successfulReturnCallsOnCompleteTwice() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); final Semaphore semaphore = new Semaphore(0); final Iterator iterator = Arrays.asList("doc1", "doc2").iterator(); @@ -1096,7 +1096,7 @@ public void retriesAfterRetryableError() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); // Verify the responses final Semaphore semaphore = new Semaphore(0); @@ -1150,7 +1150,7 @@ public void doesNotRetryAfterNonRetryableError() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); // Verify the responses final Semaphore semaphore = new Semaphore(0); @@ -1188,7 +1188,7 @@ public void onlyRetriesWhenResultSent() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); assertThrows(ExecutionException.class, () -> query.get().get()); @@ -1220,7 +1220,7 @@ public void retriesWithoutTimeout() throws Exception { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); query.get().get(); @@ -1248,7 +1248,7 @@ public void doesNotRetryWithTimeout() { .streamRequest( runQuery.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); assertThrows(ExecutionException.class, () -> query.get().get()); diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/RateLimiterTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/RateLimiterTest.java index baf1423000..afc4874353 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/RateLimiterTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/RateLimiterTest.java @@ -25,7 +25,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class RateLimiterTest { diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/RecursiveDeleteTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/RecursiveDeleteTest.java index 84713a679c..b040e11cd1 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/RecursiveDeleteTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/RecursiveDeleteTest.java @@ -77,10 +77,10 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mockito; import org.mockito.Spy; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.mockito.stubbing.Answer; @RunWith(MockitoJUnitRunner.class) @@ -167,7 +167,7 @@ private void setupMocks( .streamRequest( runQueryCapture.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); if (!deleteDocRef.equals("")) { childrenDocuments = new ArrayList<>(childrenDocuments); @@ -202,7 +202,7 @@ public void getAllDescendantsRootLevelCollection() throws Exception { .streamRequest( runQueryCapture.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); RunQueryRequest expectedRequest = query( @@ -231,7 +231,7 @@ public void getAllDescendantsNestedCollection() throws Exception { .streamRequest( runQueryCapture.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); RunQueryRequest expectedRequest = query( @@ -261,14 +261,14 @@ public void getAllDescendantsDocument() throws Exception { .streamRequest( runQueryCapture.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); // Include dummy response for the deleted fullDocumentPath reference. doAnswer((Answer>) mock -> successResponse(1)) .when(firestoreMock) .sendRequest( batchWriteCapture.capture(), - Matchers.>any()); + ArgumentMatchers.>any()); RunQueryRequest expectedRequest = query( @@ -294,13 +294,13 @@ public void createsRetryQueryAfterStreamExceptionWithLastReceivedDoc() throws Ex .streamRequest( runQueryCapture.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); doAnswer(mock -> successResponse(1)) .when(firestoreMock) .sendRequest( batchWriteCapture.capture(), - Matchers.>any()); + ArgumentMatchers.>any()); RunQueryRequest expectedRequest = query( @@ -368,7 +368,7 @@ public void createsSecondQueryWithCorrectStartAfter() throws Exception { .streamRequest( runQueryCapture.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); doAnswer( mock -> { @@ -399,7 +399,7 @@ public void createsSecondQueryWithCorrectStartAfter() throws Exception { .when(firestoreMock) .sendRequest( batchWriteCapture.capture(), - Matchers.>any()); + ArgumentMatchers.>any()); BulkWriter bulkWriter = firestoreMock.bulkWriter(); bulkWriter.setMaxBatchSize(maxBatchSize); @@ -564,12 +564,12 @@ public void exceptionThrownIfProvidedReferenceWasNotDeleted() throws Exception { .streamRequest( runQueryCapture.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); doReturn(BulkWriterTest.FAILED_FUTURE) .when(firestoreMock) .sendRequest( batchWriteCapture.capture(), - Matchers.>any()); + ArgumentMatchers.>any()); ApiFuture future = firestoreMock.recursiveDelete(firestoreMock.document("root/doc")); try { @@ -604,7 +604,7 @@ public void handlesSuccessfulStreamErrorRetries() throws Exception { .streamRequest( runQueryCapture.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); ResponseStubber responseStubber = new ResponseStubber() { @@ -646,7 +646,7 @@ public void handlesMultipleCallsToRecursiveDelete() throws Exception { .streamRequest( runQueryCapture.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); ResponseStubber responseStubber = new ResponseStubber() { @@ -671,7 +671,7 @@ public void usesSameBulkWriterInstanceAcrossCalls() throws Exception { .streamRequest( runQueryCapture.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); final int[] callCount = {0}; final BulkWriter bulkWriter = firestoreMock.bulkWriter(); diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/ToStringTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/ToStringTest.java index db0843f836..9dca2518e7 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/ToStringTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/ToStringTest.java @@ -28,7 +28,7 @@ import org.junit.runner.RunWith; import org.mockito.Mockito; import org.mockito.Spy; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; /** @author Eran Leshem */ @RunWith(MockitoJUnitRunner.class) diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/TransactionTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/TransactionTest.java index 7f9200222b..d269f07a81 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/TransactionTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/TransactionTest.java @@ -78,9 +78,9 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Spy; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @SuppressWarnings("deprecation") @RunWith(MockitoJUnitRunner.class) @@ -132,7 +132,7 @@ public void returnsValue() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(0, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), Matchers.>any()); + .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); ApiFuture transaction = firestoreMock.runTransaction( @@ -156,7 +156,7 @@ public void returnsValueAsync() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(0, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), Matchers.>any()); + .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); ApiFuture transaction = firestoreMock.runAsyncTransaction( @@ -180,7 +180,7 @@ public void canReturnNull() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(0, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), Matchers.>any()); + .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); ApiFuture transaction = firestoreMock.runTransaction(transaction1 -> null, options); @@ -192,7 +192,7 @@ public void canReturnNullAsync() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(0, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), Matchers.>any()); + .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); ApiFuture transaction = firestoreMock.runAsyncTransaction(t -> ApiFutures.immediateFuture(null), options); @@ -205,7 +205,7 @@ public void rollbackOnCallbackError() { doReturn(beginResponse()) .doReturn(rollbackResponse()) .when(firestoreMock) - .sendRequest(requestCapture.capture(), Matchers.>any()); + .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); ApiFuture transaction = firestoreMock.runTransaction( @@ -233,7 +233,7 @@ public void rollbackOnCallbackApiFutureErrorAsync() { doReturn(beginResponse()) .doReturn(rollbackResponse()) .when(firestoreMock) - .sendRequest(requestCapture.capture(), Matchers.>any()); + .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); ApiFuture transaction = firestoreMock.runAsyncTransaction( @@ -257,7 +257,7 @@ public void rollbackOnCallbackApiFutureErrorAsync() { public void noRollbackOnBeginFailure() { doReturn(ApiFutures.immediateFailedFuture(new Exception("Expected exception"))) .when(firestoreMock) - .sendRequest(requestCapture.capture(), Matchers.>any()); + .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); ApiFuture transaction = firestoreMock.runTransaction( @@ -282,7 +282,7 @@ public void noRollbackOnBeginFailure() { public void noRollbackOnBeginFailureAsync() { doReturn(ApiFutures.immediateFailedFuture(new Exception("Expected exception"))) .when(firestoreMock) - .sendRequest(requestCapture.capture(), Matchers.>any()); + .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); ApiFuture transaction = firestoreMock.runAsyncTransaction( @@ -308,7 +308,7 @@ public void noRollbackOnThrownExceptionAsync() { doReturn(beginResponse()) .doReturn(rollbackResponse()) .when(firestoreMock) - .sendRequest(requestCapture.capture(), Matchers.>any()); + .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); ApiFuture transaction = firestoreMock.runAsyncTransaction( @@ -537,11 +537,11 @@ public void getDocument() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(0, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), Matchers.>any()); + .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); doAnswer(getAllResponse(SINGLE_FIELD_PROTO)) .when(firestoreMock) - .streamRequest(requestCapture.capture(), streamObserverCapture.capture(), Matchers.any()); + .streamRequest(requestCapture.capture(), streamObserverCapture.capture(), ArgumentMatchers.any()); ApiFuture transaction = firestoreMock.runTransaction(t -> t.get(documentReference).get(), options); @@ -561,11 +561,11 @@ public void getDocumentAsync() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(0, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), Matchers.>any()); + .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); doAnswer(getAllResponse(SINGLE_FIELD_PROTO)) .when(firestoreMock) - .streamRequest(requestCapture.capture(), streamObserverCapture.capture(), Matchers.any()); + .streamRequest(requestCapture.capture(), streamObserverCapture.capture(), ArgumentMatchers.any()); ApiFuture transaction = firestoreMock.runAsyncTransaction(t -> t.get(documentReference), options); @@ -588,11 +588,11 @@ public void getMultipleDocuments() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(0, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), Matchers.>any()); + .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); doAnswer(getAllResponse(SINGLE_FIELD_PROTO)) .when(firestoreMock) - .streamRequest(requestCapture.capture(), streamObserverCapture.capture(), Matchers.any()); + .streamRequest(requestCapture.capture(), streamObserverCapture.capture(), ArgumentMatchers.any()); ApiFuture> transaction = firestoreMock.runTransaction(t -> t.getAll(doc1, doc2).get(), options); @@ -615,14 +615,14 @@ public void getMultipleDocumentsWithFieldMask() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(0, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), Matchers.>any()); + .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); doAnswer(getAllResponse(SINGLE_FIELD_PROTO)) .when(firestoreMock) .streamRequest( requestCapture.capture(), streamObserverCapture.capture(), - Matchers.any()); + ArgumentMatchers.any()); final DocumentReference doc1 = firestoreMock.document("coll/doc1"); final FieldMask fieldMask = FieldMask.of(FieldPath.of("foo", "bar")); @@ -652,11 +652,11 @@ public void getQuery() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(0, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), Matchers.>any()); + .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); doAnswer(queryResponse()) .when(firestoreMock) - .streamRequest(requestCapture.capture(), streamObserverCapture.capture(), Matchers.any()); + .streamRequest(requestCapture.capture(), streamObserverCapture.capture(), ArgumentMatchers.any()); ApiFuture transaction = firestoreMock.runTransaction(t -> t.get(queryReference).get(), options); @@ -676,11 +676,11 @@ public void getAggregateQuery() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(0, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), Matchers.>any()); + .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); doAnswer(aggregationQueryResponse(42)) .when(firestoreMock) - .streamRequest(requestCapture.capture(), streamObserverCapture.capture(), Matchers.any()); + .streamRequest(requestCapture.capture(), streamObserverCapture.capture(), ArgumentMatchers.any()); ApiFuture transaction = firestoreMock.runTransaction(t -> t.get(aggregateQueryReference).get(), options); @@ -700,7 +700,7 @@ public void updateDocument() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(2, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), Matchers.>any()); + .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); ApiFuture transaction = firestoreMock.runTransaction( @@ -731,7 +731,7 @@ public void setDocument() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(2, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), Matchers.>any()); + .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); ApiFuture transaction = firestoreMock.runTransaction( @@ -762,7 +762,7 @@ public void createDocument() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(2, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), Matchers.>any()); + .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); ApiFuture transaction = firestoreMock.runTransaction( @@ -793,7 +793,7 @@ public void deleteDocument() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(2, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), Matchers.>any()); + .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); ApiFuture transaction = firestoreMock.runTransaction( @@ -899,7 +899,7 @@ public void readWriteTransactionOptionsBuilder_errorAttemptingToSetNumAttemptsLe @Test public void getShouldThrowWhenInvokedAfterAWriteWithAQuery() throws Exception { - doReturn(beginResponse()).when(firestoreMock).sendRequest(Matchers.any(), Matchers.any()); + doReturn(beginResponse()).when(firestoreMock).sendRequest(ArgumentMatchers.any(), ArgumentMatchers.any()); ApiFuture transaction = firestoreMock.runTransaction( @@ -916,7 +916,7 @@ public void getShouldThrowWhenInvokedAfterAWriteWithAQuery() throws Exception { @Test public void getShouldThrowWhenInvokedAfterAWriteWithAnAggregateQuery() throws Exception { - doReturn(beginResponse()).when(firestoreMock).sendRequest(Matchers.any(), Matchers.any()); + doReturn(beginResponse()).when(firestoreMock).sendRequest(ArgumentMatchers.any(), ArgumentMatchers.any()); ApiFuture transaction = firestoreMock.runTransaction( diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/WatchTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/WatchTest.java index c6545fe1a8..c16d0f8b07 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/WatchTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/WatchTest.java @@ -77,10 +77,10 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mockito; import org.mockito.Spy; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.mockito.stubbing.Answer; @RunWith(MockitoJUnitRunner.class) @@ -159,7 +159,7 @@ public void before() { doReturn(immediateExecutor).when(firestoreRpc).getExecutor(); doAnswer(newRequestObserver()) .when(firestoreMock) - .streamRequest(streamObserverCapture.capture(), Matchers.any()); + .streamRequest(streamObserverCapture.capture(), ArgumentMatchers.any()); } @After diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/WriteBatchTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/WriteBatchTest.java index 7dace68293..6c5d2a9225 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/WriteBatchTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/WriteBatchTest.java @@ -44,10 +44,10 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mockito; import org.mockito.Spy; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class WriteBatchTest { @@ -75,7 +75,7 @@ public void updateDocument() throws Exception { doReturn(commitResponse(4, 0)) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); List preconditions = Arrays.asList( @@ -118,7 +118,7 @@ public void updateDocumentWithPOJO() throws Exception { doReturn(commitResponse(1, 0)) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); batch.update(documentReference, "foo", UPDATE_SINGLE_FIELD_OBJECT); assertEquals(1, batch.getMutationsSize()); @@ -137,7 +137,7 @@ public void setDocument() throws Exception { doReturn(commitResponse(4, 0)) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); batch .set(documentReference, LocalFirestoreHelper.SINGLE_FIELD_MAP) @@ -167,7 +167,7 @@ public void setDocumentWithValue() throws Exception { doReturn(commitResponse(4, 0)) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); batch .set(documentReference, LocalFirestoreHelper.SINGLE_FIELD_PROTO) @@ -197,7 +197,7 @@ public void setDocumentWithFloat() throws Exception { doReturn(commitResponse(1, 0)) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); batch.set(documentReference, LocalFirestoreHelper.SINGLE_FLOAT_MAP); @@ -220,7 +220,7 @@ public void omitWriteResultForDocumentTransforms() throws Exception { doReturn(commitResponse(1, 0)) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); batch.set(documentReference, map("time", FieldValue.serverTimestamp())); @@ -235,7 +235,7 @@ public void createDocument() throws Exception { doReturn(commitResponse(2, 0)) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); batch .create(documentReference, LocalFirestoreHelper.SINGLE_FIELD_MAP) @@ -260,7 +260,7 @@ public void createDocumentWithValue() throws Exception { doReturn(commitResponse(2, 0)) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); batch .create(documentReference, LocalFirestoreHelper.SINGLE_FIELD_PROTO) @@ -285,7 +285,7 @@ public void createDocumentWithFloat() throws Exception { doReturn(commitResponse(1, 0)) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); batch.create(documentReference, LocalFirestoreHelper.SINGLE_FLOAT_MAP); @@ -308,7 +308,7 @@ public void deleteDocument() throws Exception { doReturn(commitResponse(2, 0)) .when(firestoreMock) .sendRequest( - commitCapture.capture(), Matchers.>any()); + commitCapture.capture(), ArgumentMatchers.>any()); List writes = new ArrayList<>(); batch.delete(documentReference); From 98737ec94e0ebf8e812dff57675d2ab92ef2f7f6 Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Fri, 23 Jun 2023 10:45:45 -0400 Subject: [PATCH 3/3] format --- .../cloud/firestore/BulkWriterTest.java | 8 +- .../firestore/CollectionReferenceTest.java | 5 +- .../cloud/firestore/ConformanceTest.java | 17 ++-- .../firestore/DocumentReferenceTest.java | 95 ++++++++++++------- .../google/cloud/firestore/FirestoreTest.java | 8 +- .../cloud/firestore/LocalFirestoreHelper.java | 3 +- .../google/cloud/firestore/MapperTest.java | 12 ++- .../cloud/firestore/PartitionQuery.java | 11 ++- .../cloud/firestore/QueryCountTest.java | 2 +- .../com/google/cloud/firestore/QueryTest.java | 5 +- .../cloud/firestore/RecursiveDeleteTest.java | 2 +- .../cloud/firestore/TransactionTest.java | 82 ++++++++++------ .../com/google/cloud/firestore/WatchTest.java | 5 +- .../cloud/firestore/WriteBatchTest.java | 32 ++++--- 14 files changed, 188 insertions(+), 99 deletions(-) diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/BulkWriterTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/BulkWriterTest.java index 60099af836..9dd601df6b 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/BulkWriterTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/BulkWriterTest.java @@ -65,8 +65,8 @@ import org.junit.rules.Timeout; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; -import org.mockito.Captor; import org.mockito.ArgumentMatchers; +import org.mockito.Captor; import org.mockito.Mockito; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; @@ -1325,7 +1325,8 @@ public void cannotSetThrottlingOptionsWithThrottlingDisabled() throws Exception } catch (Exception e) { assertEquals( e.getMessage(), - "Cannot set 'initialOpsPerSecond' or 'maxOpsPerSecond' when 'throttlingEnabled' is set to false."); + "Cannot set 'initialOpsPerSecond' or 'maxOpsPerSecond' when 'throttlingEnabled' is set to" + + " false."); } try { @@ -1335,7 +1336,8 @@ public void cannotSetThrottlingOptionsWithThrottlingDisabled() throws Exception } catch (Exception e) { assertEquals( e.getMessage(), - "Cannot set 'initialOpsPerSecond' or 'maxOpsPerSecond' when 'throttlingEnabled' is set to false."); + "Cannot set 'initialOpsPerSecond' or 'maxOpsPerSecond' when 'throttlingEnabled' is set to" + + " false."); } } diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/CollectionReferenceTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/CollectionReferenceTest.java index 397468d7a4..9e22b40a74 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/CollectionReferenceTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/CollectionReferenceTest.java @@ -31,8 +31,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; -import org.mockito.Captor; import org.mockito.ArgumentMatchers; +import org.mockito.Captor; import org.mockito.Mockito; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; @@ -94,7 +94,8 @@ public void addDocument() throws Exception { doReturn(LocalFirestoreHelper.SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - argCaptor.capture(), ArgumentMatchers.>any()); + argCaptor.capture(), + ArgumentMatchers.>any()); ApiFuture future = collectionReference.add(LocalFirestoreHelper.SINGLE_FIELD_MAP); diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/ConformanceTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/ConformanceTest.java index f31ea807e8..694b2c0054 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/ConformanceTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/ConformanceTest.java @@ -86,8 +86,8 @@ import org.junit.runner.RunWith; import org.junit.runners.AllTests; import org.mockito.ArgumentCaptor; -import org.mockito.Captor; import org.mockito.ArgumentMatchers; +import org.mockito.Captor; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; @@ -288,7 +288,8 @@ private ConformanceCreateTestRunner(String description, CreateTest testParameter public void runTest() { doReturn(commitResponse(testParameters.getRequest().getWritesCount(), 0)) .when(firestore) - .sendRequest(commitCapture.capture(), ArgumentMatchers.>any()); + .sendRequest( + commitCapture.capture(), ArgumentMatchers.>any()); try { ApiFuture apiCall = @@ -319,7 +320,8 @@ private ConformanceSetTestRunner(String description, SetTest testParameters) { public void runTest() { doReturn(commitResponse(testParameters.getRequest().getWritesCount(), 0)) .when(firestore) - .sendRequest(commitCapture.capture(), ArgumentMatchers.>any()); + .sendRequest( + commitCapture.capture(), ArgumentMatchers.>any()); ApiFuture apiCall; try { @@ -364,7 +366,8 @@ private ConformanceUpdateTestRunner(String description, UpdateTest testParameter public void runTest() { doReturn(commitResponse(testParameters.getRequest().getWritesCount(), 0)) .when(firestore) - .sendRequest(commitCapture.capture(), ArgumentMatchers.>any()); + .sendRequest( + commitCapture.capture(), ArgumentMatchers.>any()); try { ApiFuture apiCall; @@ -405,7 +408,8 @@ private ConformanceUpdatePathsTestRunner(String description, UpdatePathsTest tes public void runTest() { doReturn(commitResponse(testParameters.getRequest().getWritesCount(), 0)) .when(firestore) - .sendRequest(commitCapture.capture(), ArgumentMatchers.>any()); + .sendRequest( + commitCapture.capture(), ArgumentMatchers.>any()); try { ApiFuture apiCall; @@ -461,7 +465,8 @@ private ConformanceDeleteTestRunner(String description, DeleteTest testParameter public void runTest() throws Throwable { doReturn(commitResponse(0, testParameters.getRequest().getWritesCount())) .when(firestore) - .sendRequest(commitCapture.capture(), ArgumentMatchers.>any()); + .sendRequest( + commitCapture.capture(), ArgumentMatchers.>any()); if (!testParameters.hasPrecondition()) { document(testParameters.getDocRefPath()).delete().get(); diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/DocumentReferenceTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/DocumentReferenceTest.java index dab431fac2..7d982b86c6 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/DocumentReferenceTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/DocumentReferenceTest.java @@ -92,8 +92,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; -import org.mockito.Captor; import org.mockito.ArgumentMatchers; +import org.mockito.Captor; import org.mockito.Mockito; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; @@ -149,7 +149,8 @@ public void serializeBasicTypes() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); documentReference.set(ALL_SUPPORTED_TYPES_MAP).get(); documentReference.set(ALL_SUPPORTED_TYPES_OBJECT).get(); @@ -164,7 +165,8 @@ public void serializeDocumentReference() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); documentReference.set(map("docRef", documentReference)).get(); @@ -183,19 +185,22 @@ public void doesNotSerializeAdvancedNumberTypes() { pojo.bigIntegerValue = new BigInteger("0"); expectedErrorMessages.put( pojo, - "Could not serialize object. Numbers of type BigInteger are not supported, please use an int, long, float, double or BigDecimal (found in field 'bigIntegerValue')"); + "Could not serialize object. Numbers of type BigInteger are not supported, please use an" + + " int, long, float, double or BigDecimal (found in field 'bigIntegerValue')"); pojo = new InvalidPOJO(); pojo.byteValue = 0; expectedErrorMessages.put( pojo, - "Could not serialize object. Numbers of type Byte are not supported, please use an int, long, float, double or BigDecimal (found in field 'byteValue')"); + "Could not serialize object. Numbers of type Byte are not supported, please use an int," + + " long, float, double or BigDecimal (found in field 'byteValue')"); pojo = new InvalidPOJO(); pojo.shortValue = 0; expectedErrorMessages.put( pojo, - "Could not serialize object. Numbers of type Short are not supported, please use an int, long, float, double or BigDecimal (found in field 'shortValue')"); + "Could not serialize object. Numbers of type Short are not supported, please use an int," + + " long, float, double or BigDecimal (found in field 'shortValue')"); for (Map.Entry testCase : expectedErrorMessages.entrySet()) { try { @@ -332,7 +337,8 @@ public void doesNotDeserializeAdvancedNumberTypes() throws Exception { } catch (RuntimeException e) { assertEquals( String.format( - "Could not deserialize object. Deserializing values to %s is not supported (found in field '%s')", + "Could not deserialize object. Deserializing values to %s is not supported (found" + + " in field '%s')", typeName, fieldName), e.getMessage()); } @@ -369,7 +375,8 @@ public void deleteDocument() throws Exception { doReturn(SINGLE_DELETE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); documentReference.delete().get(); documentReference @@ -390,7 +397,8 @@ public void createDocument() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); documentReference.create(SINGLE_FIELD_MAP).get(); documentReference.create(SINGLE_FIELD_OBJECT).get(); @@ -407,7 +415,8 @@ public void createWithServerTimestamp() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); documentReference.create(LocalFirestoreHelper.SERVER_TIMESTAMP_MAP).get(); documentReference.create(LocalFirestoreHelper.SERVER_TIMESTAMP_OBJECT).get(); @@ -427,7 +436,8 @@ public void setWithServerTimestamp() throws Exception { doReturn(FIELD_TRANSFORM_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); documentReference.set(LocalFirestoreHelper.SERVER_TIMESTAMP_MAP).get(); documentReference.set(LocalFirestoreHelper.SERVER_TIMESTAMP_OBJECT).get(); @@ -447,7 +457,8 @@ public void updateWithServerTimestamp() throws Exception { doReturn(FIELD_TRANSFORM_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); documentReference.update(LocalFirestoreHelper.SERVER_TIMESTAMP_MAP).get(); @@ -474,7 +485,8 @@ public void mergeWithServerTimestamps() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); documentReference .set(LocalFirestoreHelper.SERVER_TIMESTAMP_MAP, SetOptions.mergeFields("inner.bar")) @@ -498,7 +510,8 @@ public void setWithIncrement() throws Exception { doReturn(FIELD_TRANSFORM_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); documentReference .set(map("integer", FieldValue.increment(1), "double", FieldValue.increment(1.1))) @@ -522,7 +535,8 @@ public void setWithArrayUnion() throws Exception { doReturn(FIELD_TRANSFORM_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); documentReference.set(map("foo", FieldValue.arrayUnion("bar", map("foo", "baz")))).get(); @@ -540,7 +554,8 @@ public void setWithArrayRemove() throws Exception { doReturn(FIELD_TRANSFORM_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); documentReference.set(map("foo", FieldValue.arrayRemove("bar", map("foo", "baz")))).get(); @@ -688,7 +703,8 @@ public void setDocumentWithMerge() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); documentReference.set(SINGLE_FIELD_MAP, SetOptions.merge()).get(); documentReference.set(SINGLE_FIELD_OBJECT, SetOptions.merge()).get(); @@ -714,7 +730,8 @@ public void setDocumentWithEmptyMerge() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); documentReference.set(map(), SetOptions.merge()).get(); @@ -727,7 +744,8 @@ public void setDocumentWithNestedMerge() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); documentReference.set(NESTED_CLASS_OBJECT, SetOptions.mergeFields("first.foo")).get(); documentReference @@ -756,7 +774,8 @@ public void setMultipleFieldsWithMerge() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); documentReference .set( @@ -784,7 +803,8 @@ public void setNestedMapWithMerge() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); documentReference.set(NESTED_CLASS_OBJECT, SetOptions.mergeFields("first", "second")).get(); @@ -804,7 +824,8 @@ public void mergeWithDotsInFieldName() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); documentReference .set( @@ -828,7 +849,8 @@ public void extractFieldMaskFromMerge() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); documentReference.set(NESTED_CLASS_OBJECT, SetOptions.merge()).get(); @@ -868,7 +890,8 @@ public void updateDocument() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); documentReference.update(SINGLE_FIELD_MAP); documentReference.update("foo", "bar").get(); @@ -886,7 +909,8 @@ public void updateWithDotsInFieldName() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); documentReference.update(map("a.b.c", map("d.e", "foo"))).get(); @@ -910,7 +934,8 @@ public void updateNestedMap() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); documentReference.update("a.b", "foo", "a.c", FieldValue.delete()).get(); @@ -961,7 +986,8 @@ public void deleteField() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); documentReference.update("foo", "bar", "bar.foo", FieldValue.delete()).get(); @@ -981,7 +1007,8 @@ public void updateNestedDocument() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); Map nestedObject = new HashMap<>(); nestedObject.put("a", "b"); @@ -1005,7 +1032,8 @@ public void updateDocumentWithTwoFields() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); documentReference.update("a", "b", "c", "d").get(); @@ -1027,7 +1055,8 @@ public void updateDocumentWithPreconditions() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); Precondition options = Precondition.updatedAt(Timestamp.ofTimeSecondsAndNanos(479978400, 123000000)); @@ -1052,7 +1081,8 @@ public void updateIndividualPojo() throws ExecutionException, InterruptedExcepti doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); documentReference.update(UPDATED_POJO); documentReference.update(UPDATED_POJO).get(); CommitRequest expectedCommit = @@ -1068,7 +1098,8 @@ public void deleteNestedFieldUsingFieldPath() throws Exception { doReturn(SINGLE_WRITE_COMMIT_RESPONSE) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); FieldPath path = FieldPath.of("a.b", "c.d"); documentReference.update(path, FieldValue.delete()).get(); CommitRequest expectedCommit = diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/FirestoreTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/FirestoreTest.java index 281a8a37a9..d4df6220b4 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/FirestoreTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/FirestoreTest.java @@ -47,8 +47,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; -import org.mockito.Captor; import org.mockito.ArgumentMatchers; +import org.mockito.Captor; import org.mockito.Mockito; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; @@ -190,7 +190,8 @@ public void arrayUnionWithPojo() throws ExecutionException, InterruptedException doReturn(commitResponse(1, 0)) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); DocumentReference doc = firestoreMock.document("coll/doc"); doc.update("array", FieldValue.arrayUnion(SINGLE_FIELD_OBJECT)).get(); @@ -208,7 +209,8 @@ public void arrayRemoveWithPojo() throws ExecutionException, InterruptedExceptio doReturn(commitResponse(1, 0)) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); DocumentReference doc = firestoreMock.document("coll/doc"); doc.update("array", FieldValue.arrayRemove(SINGLE_FIELD_OBJECT)).get(); diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/LocalFirestoreHelper.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/LocalFirestoreHelper.java index 56632c1538..896a51e3af 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/LocalFirestoreHelper.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/LocalFirestoreHelper.java @@ -1203,7 +1203,8 @@ void initializeStub( Preconditions.checkNotNull(stubber, "Stubber should not be null"); stubber .when(firestoreMock) - .sendRequest(argumentCaptor.capture(), ArgumentMatchers.>any()); + .sendRequest( + argumentCaptor.capture(), ArgumentMatchers.>any()); } public void verifyAllRequestsSent() { diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/MapperTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/MapperTest.java index 5324fa855c..5ea6cd84f9 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/MapperTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/MapperTest.java @@ -1850,7 +1850,8 @@ public void shortsCantBeSerialized() { final ShortBean bean = new ShortBean(); bean.value = 1; assertExceptionContains( - "Numbers of type Short are not supported, please use an int, long, float, double or BigDecimal (found in field 'value')", + "Numbers of type Short are not supported, please use an int, long, float, double or" + + " BigDecimal (found in field 'value')", () -> serialize(bean)); } @@ -1859,7 +1860,8 @@ public void bytesCantBeSerialized() { final ByteBean bean = new ByteBean(); bean.value = 1; assertExceptionContains( - "Numbers of type Byte are not supported, please use an int, long, float, double or BigDecimal (found in field 'value')", + "Numbers of type Byte are not supported, please use an int, long, float, double or" + + " BigDecimal (found in field 'value')", () -> serialize(bean)); } @@ -2193,14 +2195,16 @@ public void enumsAreSerialized() { bean.pathologicalEnum = PathologicalEnum.One; bean.setEnumValue(SimpleEnum.Foo); assertJson( - "{'enumField': 'Bar', 'enumValue': 'Foo', 'complexEnum': 'One', 'enumUsingPropertyName': 'Three', 'pathologicalEnum': 'Two'}", + "{'enumField': 'Bar', 'enumValue': 'Foo', 'complexEnum': 'One', 'enumUsingPropertyName':" + + " 'Three', 'pathologicalEnum': 'Two'}", serialize(bean)); } @Test public void enumsAreParsed() { String json = - "{'enumField': 'Bar', 'enumValue': 'Foo', 'complexEnum': 'One', 'enumUsingPropertyName': 'Three', 'pathologicalEnum': 'Two'}"; + "{'enumField': 'Bar', 'enumValue': 'Foo', 'complexEnum': 'One', 'enumUsingPropertyName':" + + " 'Three', 'pathologicalEnum': 'Two'}"; EnumBean bean = deserialize(json, EnumBean.class); assertEquals(bean.enumField, SimpleEnum.Bar); assertEquals(bean.enumValue, SimpleEnum.Foo); diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/PartitionQuery.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/PartitionQuery.java index e4a3af593a..4478ea9c97 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/PartitionQuery.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/PartitionQuery.java @@ -43,8 +43,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; -import org.mockito.Captor; import org.mockito.ArgumentMatchers; +import org.mockito.Captor; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.Spy; @@ -109,7 +109,8 @@ public void requestsOneLessThanDesired() throws Exception { .when(firestoreMock) .sendRequest( requestCaptor.capture(), - ArgumentMatchers.>any()); + ArgumentMatchers + .>any()); firestoreMock.collectionGroup("collectionId").getPartitions(desiredPartitionsCount).get(); @@ -153,7 +154,8 @@ public void convertsPartitionsToQueries() throws Exception { .when(firestoreMock) .sendRequest( requestCaptor.capture(), - ArgumentMatchers.>any()); + ArgumentMatchers + .>any()); doAnswer(queryResponse()) .when(firestoreMock) @@ -193,7 +195,8 @@ public void sortsPartitions() throws Exception { .when(firestoreMock) .sendRequest( requestCaptor.capture(), - ArgumentMatchers.>any()); + ArgumentMatchers + .>any()); List partitions = firestoreMock.collectionGroup("collectionId").getPartitions(desiredPartitionsCount).get(); diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/QueryCountTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/QueryCountTest.java index f4f3063258..2aac665e64 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/QueryCountTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/QueryCountTest.java @@ -48,8 +48,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; -import org.mockito.Captor; import org.mockito.ArgumentMatchers; +import org.mockito.Captor; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; import org.threeten.bp.Duration; diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/QueryTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/QueryTest.java index 1fa92fc242..aa2c5d50cb 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/QueryTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/QueryTest.java @@ -76,8 +76,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; -import org.mockito.Captor; import org.mockito.ArgumentMatchers; +import org.mockito.Captor; import org.mockito.Mockito; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; @@ -517,7 +517,8 @@ public void validatesQueryOperatorForFieldPathDocumentId() { fail(); } catch (IllegalArgumentException e) { assertEquals( - "Invalid query. You cannot perform 'ARRAY_CONTAINS_ANY' queries on FieldPath.documentId().", + "Invalid query. You cannot perform 'ARRAY_CONTAINS_ANY' queries on" + + " FieldPath.documentId().", e.getMessage()); } } diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/RecursiveDeleteTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/RecursiveDeleteTest.java index b040e11cd1..409398c71e 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/RecursiveDeleteTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/RecursiveDeleteTest.java @@ -76,8 +76,8 @@ import org.junit.rules.Timeout; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; -import org.mockito.Captor; import org.mockito.ArgumentMatchers; +import org.mockito.Captor; import org.mockito.Mockito; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/TransactionTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/TransactionTest.java index d269f07a81..4c559486bc 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/TransactionTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/TransactionTest.java @@ -77,8 +77,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; -import org.mockito.Captor; import org.mockito.ArgumentMatchers; +import org.mockito.Captor; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; @@ -132,7 +132,8 @@ public void returnsValue() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(0, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); + .sendRequest( + requestCapture.capture(), ArgumentMatchers.>any()); ApiFuture transaction = firestoreMock.runTransaction( @@ -156,7 +157,8 @@ public void returnsValueAsync() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(0, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); + .sendRequest( + requestCapture.capture(), ArgumentMatchers.>any()); ApiFuture transaction = firestoreMock.runAsyncTransaction( @@ -180,7 +182,8 @@ public void canReturnNull() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(0, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); + .sendRequest( + requestCapture.capture(), ArgumentMatchers.>any()); ApiFuture transaction = firestoreMock.runTransaction(transaction1 -> null, options); @@ -192,7 +195,8 @@ public void canReturnNullAsync() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(0, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); + .sendRequest( + requestCapture.capture(), ArgumentMatchers.>any()); ApiFuture transaction = firestoreMock.runAsyncTransaction(t -> ApiFutures.immediateFuture(null), options); @@ -205,7 +209,8 @@ public void rollbackOnCallbackError() { doReturn(beginResponse()) .doReturn(rollbackResponse()) .when(firestoreMock) - .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); + .sendRequest( + requestCapture.capture(), ArgumentMatchers.>any()); ApiFuture transaction = firestoreMock.runTransaction( @@ -233,7 +238,8 @@ public void rollbackOnCallbackApiFutureErrorAsync() { doReturn(beginResponse()) .doReturn(rollbackResponse()) .when(firestoreMock) - .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); + .sendRequest( + requestCapture.capture(), ArgumentMatchers.>any()); ApiFuture transaction = firestoreMock.runAsyncTransaction( @@ -257,7 +263,8 @@ public void rollbackOnCallbackApiFutureErrorAsync() { public void noRollbackOnBeginFailure() { doReturn(ApiFutures.immediateFailedFuture(new Exception("Expected exception"))) .when(firestoreMock) - .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); + .sendRequest( + requestCapture.capture(), ArgumentMatchers.>any()); ApiFuture transaction = firestoreMock.runTransaction( @@ -282,7 +289,8 @@ public void noRollbackOnBeginFailure() { public void noRollbackOnBeginFailureAsync() { doReturn(ApiFutures.immediateFailedFuture(new Exception("Expected exception"))) .when(firestoreMock) - .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); + .sendRequest( + requestCapture.capture(), ArgumentMatchers.>any()); ApiFuture transaction = firestoreMock.runAsyncTransaction( @@ -308,7 +316,8 @@ public void noRollbackOnThrownExceptionAsync() { doReturn(beginResponse()) .doReturn(rollbackResponse()) .when(firestoreMock) - .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); + .sendRequest( + requestCapture.capture(), ArgumentMatchers.>any()); ApiFuture transaction = firestoreMock.runAsyncTransaction( @@ -537,11 +546,13 @@ public void getDocument() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(0, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); + .sendRequest( + requestCapture.capture(), ArgumentMatchers.>any()); doAnswer(getAllResponse(SINGLE_FIELD_PROTO)) .when(firestoreMock) - .streamRequest(requestCapture.capture(), streamObserverCapture.capture(), ArgumentMatchers.any()); + .streamRequest( + requestCapture.capture(), streamObserverCapture.capture(), ArgumentMatchers.any()); ApiFuture transaction = firestoreMock.runTransaction(t -> t.get(documentReference).get(), options); @@ -561,11 +572,13 @@ public void getDocumentAsync() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(0, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); + .sendRequest( + requestCapture.capture(), ArgumentMatchers.>any()); doAnswer(getAllResponse(SINGLE_FIELD_PROTO)) .when(firestoreMock) - .streamRequest(requestCapture.capture(), streamObserverCapture.capture(), ArgumentMatchers.any()); + .streamRequest( + requestCapture.capture(), streamObserverCapture.capture(), ArgumentMatchers.any()); ApiFuture transaction = firestoreMock.runAsyncTransaction(t -> t.get(documentReference), options); @@ -588,11 +601,13 @@ public void getMultipleDocuments() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(0, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); + .sendRequest( + requestCapture.capture(), ArgumentMatchers.>any()); doAnswer(getAllResponse(SINGLE_FIELD_PROTO)) .when(firestoreMock) - .streamRequest(requestCapture.capture(), streamObserverCapture.capture(), ArgumentMatchers.any()); + .streamRequest( + requestCapture.capture(), streamObserverCapture.capture(), ArgumentMatchers.any()); ApiFuture> transaction = firestoreMock.runTransaction(t -> t.getAll(doc1, doc2).get(), options); @@ -615,7 +630,8 @@ public void getMultipleDocumentsWithFieldMask() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(0, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); + .sendRequest( + requestCapture.capture(), ArgumentMatchers.>any()); doAnswer(getAllResponse(SINGLE_FIELD_PROTO)) .when(firestoreMock) @@ -652,11 +668,13 @@ public void getQuery() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(0, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); + .sendRequest( + requestCapture.capture(), ArgumentMatchers.>any()); doAnswer(queryResponse()) .when(firestoreMock) - .streamRequest(requestCapture.capture(), streamObserverCapture.capture(), ArgumentMatchers.any()); + .streamRequest( + requestCapture.capture(), streamObserverCapture.capture(), ArgumentMatchers.any()); ApiFuture transaction = firestoreMock.runTransaction(t -> t.get(queryReference).get(), options); @@ -676,11 +694,13 @@ public void getAggregateQuery() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(0, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); + .sendRequest( + requestCapture.capture(), ArgumentMatchers.>any()); doAnswer(aggregationQueryResponse(42)) .when(firestoreMock) - .streamRequest(requestCapture.capture(), streamObserverCapture.capture(), ArgumentMatchers.any()); + .streamRequest( + requestCapture.capture(), streamObserverCapture.capture(), ArgumentMatchers.any()); ApiFuture transaction = firestoreMock.runTransaction(t -> t.get(aggregateQueryReference).get(), options); @@ -700,7 +720,8 @@ public void updateDocument() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(2, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); + .sendRequest( + requestCapture.capture(), ArgumentMatchers.>any()); ApiFuture transaction = firestoreMock.runTransaction( @@ -731,7 +752,8 @@ public void setDocument() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(2, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); + .sendRequest( + requestCapture.capture(), ArgumentMatchers.>any()); ApiFuture transaction = firestoreMock.runTransaction( @@ -762,7 +784,8 @@ public void createDocument() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(2, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); + .sendRequest( + requestCapture.capture(), ArgumentMatchers.>any()); ApiFuture transaction = firestoreMock.runTransaction( @@ -793,7 +816,8 @@ public void deleteDocument() throws Exception { doReturn(beginResponse()) .doReturn(commitResponse(2, 0)) .when(firestoreMock) - .sendRequest(requestCapture.capture(), ArgumentMatchers.>any()); + .sendRequest( + requestCapture.capture(), ArgumentMatchers.>any()); ApiFuture transaction = firestoreMock.runTransaction( @@ -899,7 +923,9 @@ public void readWriteTransactionOptionsBuilder_errorAttemptingToSetNumAttemptsLe @Test public void getShouldThrowWhenInvokedAfterAWriteWithAQuery() throws Exception { - doReturn(beginResponse()).when(firestoreMock).sendRequest(ArgumentMatchers.any(), ArgumentMatchers.any()); + doReturn(beginResponse()) + .when(firestoreMock) + .sendRequest(ArgumentMatchers.any(), ArgumentMatchers.any()); ApiFuture transaction = firestoreMock.runTransaction( @@ -916,7 +942,9 @@ public void getShouldThrowWhenInvokedAfterAWriteWithAQuery() throws Exception { @Test public void getShouldThrowWhenInvokedAfterAWriteWithAnAggregateQuery() throws Exception { - doReturn(beginResponse()).when(firestoreMock).sendRequest(ArgumentMatchers.any(), ArgumentMatchers.any()); + doReturn(beginResponse()) + .when(firestoreMock) + .sendRequest(ArgumentMatchers.any(), ArgumentMatchers.any()); ApiFuture transaction = firestoreMock.runTransaction( diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/WatchTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/WatchTest.java index c16d0f8b07..1e18b897cb 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/WatchTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/WatchTest.java @@ -76,8 +76,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; -import org.mockito.Captor; import org.mockito.ArgumentMatchers; +import org.mockito.Captor; import org.mockito.Mockito; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; @@ -159,7 +159,8 @@ public void before() { doReturn(immediateExecutor).when(firestoreRpc).getExecutor(); doAnswer(newRequestObserver()) .when(firestoreMock) - .streamRequest(streamObserverCapture.capture(), ArgumentMatchers.any()); + .streamRequest( + streamObserverCapture.capture(), ArgumentMatchers.any()); } @After diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/WriteBatchTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/WriteBatchTest.java index 6c5d2a9225..92ca905c79 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/WriteBatchTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/WriteBatchTest.java @@ -43,8 +43,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; -import org.mockito.Captor; import org.mockito.ArgumentMatchers; +import org.mockito.Captor; import org.mockito.Mockito; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; @@ -75,7 +75,8 @@ public void updateDocument() throws Exception { doReturn(commitResponse(4, 0)) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); List preconditions = Arrays.asList( @@ -118,7 +119,8 @@ public void updateDocumentWithPOJO() throws Exception { doReturn(commitResponse(1, 0)) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); batch.update(documentReference, "foo", UPDATE_SINGLE_FIELD_OBJECT); assertEquals(1, batch.getMutationsSize()); @@ -137,7 +139,8 @@ public void setDocument() throws Exception { doReturn(commitResponse(4, 0)) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); batch .set(documentReference, LocalFirestoreHelper.SINGLE_FIELD_MAP) @@ -167,7 +170,8 @@ public void setDocumentWithValue() throws Exception { doReturn(commitResponse(4, 0)) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); batch .set(documentReference, LocalFirestoreHelper.SINGLE_FIELD_PROTO) @@ -197,7 +201,8 @@ public void setDocumentWithFloat() throws Exception { doReturn(commitResponse(1, 0)) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); batch.set(documentReference, LocalFirestoreHelper.SINGLE_FLOAT_MAP); @@ -220,7 +225,8 @@ public void omitWriteResultForDocumentTransforms() throws Exception { doReturn(commitResponse(1, 0)) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); batch.set(documentReference, map("time", FieldValue.serverTimestamp())); @@ -235,7 +241,8 @@ public void createDocument() throws Exception { doReturn(commitResponse(2, 0)) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); batch .create(documentReference, LocalFirestoreHelper.SINGLE_FIELD_MAP) @@ -260,7 +267,8 @@ public void createDocumentWithValue() throws Exception { doReturn(commitResponse(2, 0)) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); batch .create(documentReference, LocalFirestoreHelper.SINGLE_FIELD_PROTO) @@ -285,7 +293,8 @@ public void createDocumentWithFloat() throws Exception { doReturn(commitResponse(1, 0)) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); batch.create(documentReference, LocalFirestoreHelper.SINGLE_FLOAT_MAP); @@ -308,7 +317,8 @@ public void deleteDocument() throws Exception { doReturn(commitResponse(2, 0)) .when(firestoreMock) .sendRequest( - commitCapture.capture(), ArgumentMatchers.>any()); + commitCapture.capture(), + ArgumentMatchers.>any()); List writes = new ArrayList<>(); batch.delete(documentReference);