@@ -460,6 +460,37 @@ public void testUpdateOptionsWithPriorityHashCode() {
460
460
assertNotEquals (optionsWithHighPriority1 .hashCode (), optionsWithMediumPriority .hashCode ());
461
461
}
462
462
463
+ @ Test
464
+ public void testPartitionedUpdateOptions () {
465
+ Options option1 = Options .fromPartitinoedUpdateOptions ();
466
+ Options option2 = Options .fromPartitinoedUpdateOptions ();
467
+ assertEquals (option1 , option2 );
468
+ assertEquals (option1 .hashCode (), option2 .hashCode ());
469
+ assertEquals (option1 .toString (), option2 .toString ());
470
+ assertEquals ("" , option1 .toString ());
471
+ }
472
+
473
+ @ Test
474
+ public void testPartitionedUpdateOptionsWithPriority () {
475
+ Options optionsWithHighPriority1 =
476
+ Options .fromPartitinoedUpdateOptions (Options .priority (RpcPriority .HIGH ));
477
+ assertEquals (Priority .PRIORITY_HIGH , optionsWithHighPriority1 .priority ());
478
+ assertEquals ("priority: HIGH " , optionsWithHighPriority1 .toString ());
479
+
480
+ Options optionsWithHighPriority2 =
481
+ Options .fromPartitinoedUpdateOptions (Options .priority (RpcPriority .HIGH ));
482
+ assertEquals (optionsWithHighPriority1 , optionsWithHighPriority2 );
483
+ assertEquals (optionsWithHighPriority1 .hashCode (), optionsWithHighPriority2 .hashCode ());
484
+ assertEquals (optionsWithHighPriority1 .toString (), optionsWithHighPriority2 .toString ());
485
+
486
+ Options optionsWithMediumPriority =
487
+ Options .fromPartitinoedUpdateOptions (Options .priority (RpcPriority .MEDIUM ));
488
+ assertEquals (Priority .PRIORITY_MEDIUM , optionsWithMediumPriority .priority ());
489
+ assertEquals ("priority: MEDIUM " , optionsWithMediumPriority .toString ());
490
+ assertNotEquals (optionsWithHighPriority1 , optionsWithMediumPriority );
491
+ assertNotEquals (optionsWithHighPriority1 .hashCode (), optionsWithMediumPriority .hashCode ());
492
+ }
493
+
463
494
@ Test
464
495
public void testQueryOptionsEquality () {
465
496
Options option1 = Options .fromQueryOptions ();
@@ -617,6 +648,26 @@ public void updateEquality() {
617
648
assertThat (o2 .equals (o3 )).isFalse ();
618
649
}
619
650
651
+ @ Test
652
+ public void partitionedUpdateWithTag () {
653
+ String tag1 = "app=spanner,env=test" ;
654
+ Options o1 = Options .fromPartitinoedUpdateOptions (Options .tag (tag1 ));
655
+ assertEquals (tag1 , o1 .tag ());
656
+ assertEquals ("tag: " + tag1 + " " , o1 .toString ());
657
+
658
+ Options o2 = Options .fromPartitinoedUpdateOptions (Options .tag (tag1 ));
659
+ assertEquals (o1 , o2 );
660
+ assertEquals (o1 .hashCode (), o2 .hashCode ());
661
+ assertEquals (o1 .toString (), o2 .toString ());
662
+
663
+ String tag2 = "app=spanner,env=stage" ;
664
+ Options o3 = Options .fromPartitinoedUpdateOptions (Options .tag (tag2 ));
665
+ assertEquals ("tag: " + tag2 + " " , o3 .toString ());
666
+ assertNotEquals (o2 , o3 );
667
+ assertNotEquals (o2 .hashCode (), o3 .hashCode ());
668
+ assertNotEquals (o2 .toString (), o3 .toString ());
669
+ }
670
+
620
671
@ Test
621
672
public void transactionOptionsTest () {
622
673
String tag = "app=spanner,env=test" ;
@@ -706,27 +757,27 @@ public void transactionOptionsExcludeTxnFromChangeStreams() {
706
757
assertNotEquals (option1 .hashCode (), option3 .hashCode ());
707
758
708
759
assertTrue (option1 .withExcludeTxnFromChangeStreams ());
709
- assertThat ( option1 . toString ()). contains ( "withExcludeTxnFromChangeStreams: true" );
760
+ assertEquals ( "withExcludeTxnFromChangeStreams: true " , option1 . toString () );
710
761
711
762
assertNull (option3 .withExcludeTxnFromChangeStreams ());
712
- assertThat ( option3 .toString ()). doesNotContain ( "withExcludeTxnFromChangeStreams: true" );
763
+ assertEquals ( "" , option3 .toString ());
713
764
}
714
765
715
766
@ Test
716
- public void updateOptionsExcludeTxnFromChangeStreams () {
717
- Options option1 = Options .fromUpdateOptions (Options .excludeTxnFromChangeStreams ());
718
- Options option2 = Options .fromUpdateOptions (Options .excludeTxnFromChangeStreams ());
719
- Options option3 = Options .fromUpdateOptions ();
767
+ public void partitionedUpdateOptionsExcludeTxnFromChangeStreams () {
768
+ Options option1 = Options .fromPartitinoedUpdateOptions (Options .excludeTxnFromChangeStreams ());
769
+ Options option2 = Options .fromPartitinoedUpdateOptions (Options .excludeTxnFromChangeStreams ());
770
+ Options option3 = Options .fromPartitinoedUpdateOptions ();
720
771
721
772
assertEquals (option1 , option2 );
722
773
assertEquals (option1 .hashCode (), option2 .hashCode ());
723
774
assertNotEquals (option1 , option3 );
724
775
assertNotEquals (option1 .hashCode (), option3 .hashCode ());
725
776
726
777
assertTrue (option1 .withExcludeTxnFromChangeStreams ());
727
- assertThat ( option1 . toString ()). contains ( "withExcludeTxnFromChangeStreams: true" );
778
+ assertEquals ( "withExcludeTxnFromChangeStreams: true " , option1 . toString () );
728
779
729
780
assertNull (option3 .withExcludeTxnFromChangeStreams ());
730
- assertThat ( option3 .toString ()). doesNotContain ( "withExcludeTxnFromChangeStreams: true" );
781
+ assertEquals ( "" , option3 .toString ());
731
782
}
732
783
}
0 commit comments