@@ -460,6 +460,37 @@ public void testUpdateOptionsWithPriorityHashCode() {
460460 assertNotEquals (optionsWithHighPriority1 .hashCode (), optionsWithMediumPriority .hashCode ());
461461 }
462462
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+
463494 @ Test
464495 public void testQueryOptionsEquality () {
465496 Options option1 = Options .fromQueryOptions ();
@@ -617,6 +648,26 @@ public void updateEquality() {
617648 assertThat (o2 .equals (o3 )).isFalse ();
618649 }
619650
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+
620671 @ Test
621672 public void transactionOptionsTest () {
622673 String tag = "app=spanner,env=test" ;
@@ -706,27 +757,27 @@ public void transactionOptionsExcludeTxnFromChangeStreams() {
706757 assertNotEquals (option1 .hashCode (), option3 .hashCode ());
707758
708759 assertTrue (option1 .withExcludeTxnFromChangeStreams ());
709- assertThat ( option1 . toString ()). contains ( "withExcludeTxnFromChangeStreams: true" );
760+ assertEquals ( "withExcludeTxnFromChangeStreams: true " , option1 . toString () );
710761
711762 assertNull (option3 .withExcludeTxnFromChangeStreams ());
712- assertThat ( option3 .toString ()). doesNotContain ( "withExcludeTxnFromChangeStreams: true" );
763+ assertEquals ( "" , option3 .toString ());
713764 }
714765
715766 @ 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 ();
720771
721772 assertEquals (option1 , option2 );
722773 assertEquals (option1 .hashCode (), option2 .hashCode ());
723774 assertNotEquals (option1 , option3 );
724775 assertNotEquals (option1 .hashCode (), option3 .hashCode ());
725776
726777 assertTrue (option1 .withExcludeTxnFromChangeStreams ());
727- assertThat ( option1 . toString ()). contains ( "withExcludeTxnFromChangeStreams: true" );
778+ assertEquals ( "withExcludeTxnFromChangeStreams: true " , option1 . toString () );
728779
729780 assertNull (option3 .withExcludeTxnFromChangeStreams ());
730- assertThat ( option3 .toString ()). doesNotContain ( "withExcludeTxnFromChangeStreams: true" );
781+ assertEquals ( "" , option3 .toString ());
731782 }
732783}
0 commit comments