21
21
import static org .junit .Assert .assertNotNull ;
22
22
import static org .junit .Assert .assertThrows ;
23
23
import static org .junit .Assert .fail ;
24
+ import static org .mockito .ArgumentMatchers .anyMap ;
24
25
import static org .mockito .ArgumentMatchers .eq ;
25
26
import static org .mockito .Mockito .mock ;
26
27
import static org .mockito .Mockito .when ;
@@ -223,7 +224,7 @@ public void writeAtLeastOnce() throws ParseException {
223
224
ArgumentCaptor <CommitRequest > commit = ArgumentCaptor .forClass (CommitRequest .class );
224
225
CommitResponse response =
225
226
CommitResponse .newBuilder ().setCommitTimestamp (Timestamps .parse (timestampString )).build ();
226
- Mockito .when (rpc .commit (commit .capture (), Mockito . eq ( options ))).thenReturn (response );
227
+ Mockito .when (rpc .commit (commit .capture (), anyMap ( ))).thenReturn (response );
227
228
228
229
Timestamp timestamp =
229
230
session .writeAtLeastOnce (
@@ -255,7 +256,7 @@ public void writeAtLeastOnceWithOptions() throws ParseException {
255
256
ArgumentCaptor <CommitRequest > commit = ArgumentCaptor .forClass (CommitRequest .class );
256
257
CommitResponse response =
257
258
CommitResponse .newBuilder ().setCommitTimestamp (Timestamps .parse (timestampString )).build ();
258
- Mockito .when (rpc .commit (commit .capture (), Mockito . eq ( options ))).thenReturn (response );
259
+ Mockito .when (rpc .commit (commit .capture (), anyMap ( ))).thenReturn (response );
259
260
session .writeAtLeastOnceWithOptions (
260
261
Collections .singletonList (Mutation .newInsertBuilder ("T" ).set ("C" ).to ("x" ).build ()),
261
262
Options .tag (tag ));
@@ -340,7 +341,7 @@ public void newMultiUseReadOnlyTransactionContextClosesOldSingleUseContext() {
340
341
public void writeClosesOldSingleUseContext () throws ParseException {
341
342
ReadContext ctx = session .singleUse (TimestampBound .strong ());
342
343
343
- Mockito .when (rpc .commit (Mockito .any (), Mockito . eq ( options )))
344
+ Mockito .when (rpc .commit (Mockito .any (), anyMap ( )))
344
345
.thenReturn (
345
346
CommitResponse .newBuilder ()
346
347
.setCommitTimestamp (Timestamps .parse ("2015-10-01T10:54:20.021Z" ))
@@ -442,7 +443,7 @@ public void request(int numMessages) {}
442
443
private void mockRead (final PartialResultSet myResultSet ) {
443
444
final ArgumentCaptor <SpannerRpc .ResultStreamConsumer > consumer =
444
445
ArgumentCaptor .forClass (SpannerRpc .ResultStreamConsumer .class );
445
- Mockito .when (rpc .read (Mockito .any (), consumer .capture (), Mockito . eq ( options ), eq (false )))
446
+ Mockito .when (rpc .read (Mockito .any (), consumer .capture (), anyMap ( ), eq (false )))
446
447
.then (
447
448
invocation -> {
448
449
consumer .getValue ().onPartialResultSet (myResultSet );
@@ -458,8 +459,7 @@ public void multiUseReadOnlyTransactionReturnsEmptyTransactionMetadata() {
458
459
PartialResultSet .newBuilder ()
459
460
.setMetadata (newMetadata (Type .struct (Type .StructField .of ("C" , Type .string ()))))
460
461
.build ();
461
- Mockito .when (rpc .beginTransaction (Mockito .any (), Mockito .eq (options ), eq (false )))
462
- .thenReturn (txnMetadata );
462
+ Mockito .when (rpc .beginTransaction (Mockito .any (), anyMap (), eq (false ))).thenReturn (txnMetadata );
463
463
mockRead (resultSet );
464
464
465
465
ReadOnlyTransaction txn = session .readOnlyTransaction (TimestampBound .strong ());
@@ -477,8 +477,7 @@ public void multiUseReadOnlyTransactionReturnsMissingTimestamp() {
477
477
PartialResultSet .newBuilder ()
478
478
.setMetadata (newMetadata (Type .struct (Type .StructField .of ("C" , Type .string ()))))
479
479
.build ();
480
- Mockito .when (rpc .beginTransaction (Mockito .any (), Mockito .eq (options ), eq (false )))
481
- .thenReturn (txnMetadata );
480
+ Mockito .when (rpc .beginTransaction (Mockito .any (), anyMap (), eq (false ))).thenReturn (txnMetadata );
482
481
mockRead (resultSet );
483
482
484
483
ReadOnlyTransaction txn = session .readOnlyTransaction (TimestampBound .strong ());
@@ -497,8 +496,7 @@ public void multiUseReadOnlyTransactionReturnsMissingTransactionId() throws Pars
497
496
PartialResultSet .newBuilder ()
498
497
.setMetadata (newMetadata (Type .struct (Type .StructField .of ("C" , Type .string ()))))
499
498
.build ();
500
- Mockito .when (rpc .beginTransaction (Mockito .any (), Mockito .eq (options ), eq (false )))
501
- .thenReturn (txnMetadata );
499
+ Mockito .when (rpc .beginTransaction (Mockito .any (), anyMap (), eq (false ))).thenReturn (txnMetadata );
502
500
mockRead (resultSet );
503
501
504
502
ReadOnlyTransaction txn = session .readOnlyTransaction (TimestampBound .strong ());
0 commit comments