Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions google-cloud-firestore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<artifactId>mockito-core</artifactId>
<version>4.11.0</version>

@suztomo suztomo Jun 23, 2023

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<scope>test</scope>
</dependency>
<!-- Need testing utility classes for generated gRPC clients tests -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@
import org.junit.rules.Timeout;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.ArgumentMatchers;
import org.mockito.Captor;
import org.mockito.Matchers;
import org.mockito.Mockito;
import org.mockito.Spy;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class BulkWriterTest {
Expand Down Expand Up @@ -1011,7 +1011,7 @@ public void flushSucceedsEvenIfBulkCommitFails() throws Exception {
.when(firestoreMock)
.sendRequest(
batchWriteCapture.capture(),
Matchers.<UnaryCallable<BatchWriteRequest, BatchWriteResponse>>any());
ArgumentMatchers.<UnaryCallable<BatchWriteRequest, BatchWriteResponse>>any());
bulkWriter.set(doc1, LocalFirestoreHelper.SINGLE_FIELD_MAP);
bulkWriter.set(doc2, LocalFirestoreHelper.SINGLE_FIELD_MAP);
bulkWriter.flush().get();
Expand All @@ -1023,7 +1023,7 @@ public void closeSucceedsEvenIfBulkCommitFails() throws Exception {
.when(firestoreMock)
.sendRequest(
batchWriteCapture.capture(),
Matchers.<UnaryCallable<BatchWriteRequest, BatchWriteResponse>>any());
ArgumentMatchers.<UnaryCallable<BatchWriteRequest, BatchWriteResponse>>any());
bulkWriter.set(doc1, LocalFirestoreHelper.SINGLE_FIELD_MAP);
bulkWriter.set(doc2, LocalFirestoreHelper.SINGLE_FIELD_MAP);
bulkWriter.close();
Expand All @@ -1035,7 +1035,7 @@ public void individualWritesErrorIfBulkCommitFails() throws Exception {
.when(firestoreMock)
.sendRequest(
batchWriteCapture.capture(),
Matchers.<UnaryCallable<BatchWriteRequest, BatchWriteResponse>>any());
ArgumentMatchers.<UnaryCallable<BatchWriteRequest, BatchWriteResponse>>any());
int opCount = 0;
ApiFuture<WriteResult> result1 = bulkWriter.set(doc1, LocalFirestoreHelper.SINGLE_FIELD_MAP);
ApiFuture<WriteResult> result2 = bulkWriter.set(doc2, LocalFirestoreHelper.SINGLE_FIELD_MAP);
Expand All @@ -1058,7 +1058,7 @@ public void individualWritesErrorIfBulkCommitFailsWithNonFirestoreException() th
.when(firestoreMock)
.sendRequest(
batchWriteCapture.capture(),
Matchers.<UnaryCallable<BatchWriteRequest, BatchWriteResponse>>any());
ArgumentMatchers.<UnaryCallable<BatchWriteRequest, BatchWriteResponse>>any());
int opCount = 0;
ApiFuture<WriteResult> result1 = bulkWriter.set(doc1, LocalFirestoreHelper.SINGLE_FIELD_MAP);
ApiFuture<WriteResult> result2 = bulkWriter.set(doc2, LocalFirestoreHelper.SINGLE_FIELD_MAP);
Expand Down Expand Up @@ -1086,7 +1086,7 @@ public void retriesWritesWhenBatchWriteFailsWithRetryableError() throws Exceptio
.when(firestoreMock)
.sendRequest(
batchWriteCapture.capture(),
Matchers.<UnaryCallable<BatchWriteRequest, BatchWriteResponse>>any());
ArgumentMatchers.<UnaryCallable<BatchWriteRequest, BatchWriteResponse>>any());

ApiFuture<WriteResult> result = bulkWriter.set(doc1, LocalFirestoreHelper.SINGLE_FIELD_MAP);
bulkWriter.close();
Expand Down Expand Up @@ -1125,7 +1125,7 @@ public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit)
.when(firestoreMock)
.sendRequest(
batchWriteCapture.capture(),
Matchers.<UnaryCallable<BatchWriteRequest, BatchWriteResponse>>any());
ArgumentMatchers.<UnaryCallable<BatchWriteRequest, BatchWriteResponse>>any());

bulkWriter =
firestoreMock.bulkWriter(BulkWriterOptions.builder().setExecutor(timeoutExecutor).build());
Expand Down Expand Up @@ -1175,7 +1175,7 @@ public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit)
.when(firestoreMock)
.sendRequest(
batchWriteCapture.capture(),
Matchers.<UnaryCallable<BatchWriteRequest, BatchWriteResponse>>any());
ArgumentMatchers.<UnaryCallable<BatchWriteRequest, BatchWriteResponse>>any());

bulkWriter =
firestoreMock.bulkWriter(BulkWriterOptions.builder().setExecutor(timeoutExecutor).build());
Expand Down Expand Up @@ -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 {
Expand All @@ -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.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.ArgumentMatchers;
import org.mockito.Captor;
import org.mockito.Matchers;
import org.mockito.Mockito;
import org.mockito.Spy;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class CollectionReferenceTest {
Expand Down Expand Up @@ -94,7 +94,8 @@ public void addDocument() throws Exception {
doReturn(LocalFirestoreHelper.SINGLE_WRITE_COMMIT_RESPONSE)
.when(firestoreMock)
.sendRequest(
argCaptor.capture(), Matchers.<UnaryCallable<CommitRequest, CommitResponse>>any());
argCaptor.capture(),
ArgumentMatchers.<UnaryCallable<CommitRequest, CommitResponse>>any());

ApiFuture<DocumentReference> future =
collectionReference.add(LocalFirestoreHelper.SINGLE_FIELD_MAP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@
import org.junit.runner.RunWith;
import org.junit.runners.AllTests;
import org.mockito.ArgumentCaptor;
import org.mockito.ArgumentMatchers;
import org.mockito.Captor;
import org.mockito.Matchers;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
Expand Down Expand Up @@ -264,7 +264,7 @@ public void runTest() throws Throwable {
.streamRequest(
getAllCapture.capture(),
streamObserverCapture.capture(),
Matchers.<ServerStreamingCallable>any());
ArgumentMatchers.<ServerStreamingCallable>any());

document(testParameters.getDocRefPath()).get().get();

Expand All @@ -288,7 +288,8 @@ private ConformanceCreateTestRunner(String description, CreateTest testParameter
public void runTest() {
doReturn(commitResponse(testParameters.getRequest().getWritesCount(), 0))
.when(firestore)
.sendRequest(commitCapture.capture(), Matchers.<UnaryCallable<Message, Message>>any());
.sendRequest(
commitCapture.capture(), ArgumentMatchers.<UnaryCallable<Message, Message>>any());

try {
ApiFuture<WriteResult> apiCall =
Expand Down Expand Up @@ -319,7 +320,8 @@ private ConformanceSetTestRunner(String description, SetTest testParameters) {
public void runTest() {
doReturn(commitResponse(testParameters.getRequest().getWritesCount(), 0))
.when(firestore)
.sendRequest(commitCapture.capture(), Matchers.<UnaryCallable<Message, Message>>any());
.sendRequest(
commitCapture.capture(), ArgumentMatchers.<UnaryCallable<Message, Message>>any());
ApiFuture<WriteResult> apiCall;

try {
Expand Down Expand Up @@ -364,7 +366,8 @@ private ConformanceUpdateTestRunner(String description, UpdateTest testParameter
public void runTest() {
doReturn(commitResponse(testParameters.getRequest().getWritesCount(), 0))
.when(firestore)
.sendRequest(commitCapture.capture(), Matchers.<UnaryCallable<Message, Message>>any());
.sendRequest(
commitCapture.capture(), ArgumentMatchers.<UnaryCallable<Message, Message>>any());

try {
ApiFuture<WriteResult> apiCall;
Expand Down Expand Up @@ -405,7 +408,8 @@ private ConformanceUpdatePathsTestRunner(String description, UpdatePathsTest tes
public void runTest() {
doReturn(commitResponse(testParameters.getRequest().getWritesCount(), 0))
.when(firestore)
.sendRequest(commitCapture.capture(), Matchers.<UnaryCallable<Message, Message>>any());
.sendRequest(
commitCapture.capture(), ArgumentMatchers.<UnaryCallable<Message, Message>>any());

try {
ApiFuture<WriteResult> apiCall;
Expand Down Expand Up @@ -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(), Matchers.<UnaryCallable<Message, Message>>any());
.sendRequest(
commitCapture.capture(), ArgumentMatchers.<UnaryCallable<Message, Message>>any());

if (!testParameters.hasPrecondition()) {
document(testParameters.getDocRefPath()).delete().get();
Expand Down Expand Up @@ -494,7 +499,7 @@ public void runTest() {
.streamRequest(
runQueryCapture.capture(),
streamObserverCapture.capture(),
Matchers.<ServerStreamingCallable>any());
ArgumentMatchers.<ServerStreamingCallable>any());

Query query = collection(testParameters.getCollPath());

Expand Down Expand Up @@ -647,7 +652,7 @@ public void runTest() throws Throwable {
})
.when(firestore)
.streamRequest(
streamObserverCapture.capture(), Matchers.any(BidiStreamingCallable.class));
streamObserverCapture.capture(), ArgumentMatchers.any(BidiStreamingCallable.class));

final List<Snapshot> expectedSnapshots = new ArrayList<>(testParameters.getSnapshotsList());

Expand Down
Loading