@@ -803,9 +803,13 @@ public void testRepoLabel() throws IOException {
803
803
804
804
GHLabel t = null ;
805
805
GHLabel t2 = null ;
806
+ GHLabel t3 = null ;
806
807
try {// CRUD
807
808
t = r .createLabel ("test" , "123456" );
808
809
t2 = r .getLabel ("test" );
810
+ assertThat (t , not (sameInstance (t2 )));
811
+ assertThat (t , equalTo (t2 ));
812
+
809
813
assertEquals (t .getName (), t2 .getName ());
810
814
assertEquals (t .getColor (), "123456" );
811
815
assertEquals (t .getColor (), t2 .getColor ());
@@ -815,23 +819,36 @@ public void testRepoLabel() throws IOException {
815
819
816
820
// update works on multiple changes in one call
817
821
// t.setColor("");
818
- t2 = t .update ().color ("000000" ).description ("It is dark!" ).done ();
822
+ t3 = t .update ().color ("000000" ).description ("It is dark!" ).done ();
819
823
820
824
// instances behave as immutable by default. Update returns a new updated instance.
825
+ assertThat (t , not (sameInstance (t2 )));
826
+ assertThat (t , equalTo (t2 ));
827
+
828
+ assertThat (t , not (sameInstance (t3 )));
829
+ assertThat (t , not (equalTo (t3 )));
830
+
821
831
assertEquals (t .getColor (), "123456" );
822
832
assertEquals (t .getDescription (), "" );
823
- assertEquals (t2 .getColor (), "000000" );
824
- assertEquals (t2 .getDescription (), "It is dark!" );
833
+ assertEquals (t3 .getColor (), "000000" );
834
+ assertEquals (t3 .getDescription (), "It is dark!" );
825
835
826
836
t = r .getLabel ("test" );
827
- GHLabel t3 = t .set ().description ("this is also a test" );
837
+
838
+ t3 = t .set ().description ("this is also a test" );
839
+
840
+ // instances behave as immutable by default. Update returns a new updated instance.
841
+ assertThat (t , not (sameInstance (t3 )));
842
+ assertThat (t , not (equalTo (t3 )));
828
843
829
844
assertEquals (t3 .getColor (), "000000" );
830
845
assertEquals (t3 .getDescription (), "this is also a test" );
846
+
831
847
t .delete ();
832
848
833
849
t = r .createLabel ("test2" , "123457" , "this is a different test" );
834
850
t2 = r .getLabel ("test2" );
851
+
835
852
assertEquals (t .getName (), t2 .getName ());
836
853
assertEquals (t .getColor (), "123457" );
837
854
assertEquals (t .getColor (), t2 .getColor ());
0 commit comments