File tree Expand file tree Collapse file tree 5 files changed +17
-8
lines changed
main/java/dev/openfeature/sdk
test/java/dev/openfeature/sdk Expand file tree Collapse file tree 5 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,6 @@ public boolean isEmpty() {
101101 return metadata .isEmpty ();
102102 }
103103
104-
105104 public boolean equals (final Object o ) {
106105 if (o == this ) {
107106 return true ;
Original file line number Diff line number Diff line change 55import java .util .HashMap ;
66import java .util .List ;
77import java .util .Map ;
8- import java .util .Objects ;
98import java .util .function .Function ;
10- import lombok .EqualsAndHashCode ;
119import lombok .ToString ;
1210import lombok .experimental .Delegate ;
1311
Original file line number Diff line number Diff line change @@ -315,6 +315,11 @@ public static Value objectToValue(Object object) {
315315 }
316316 }
317317
318+ /**
319+ * Returns true iff {@code this} is equal to {@code o}, or if both objects represent the same data.
320+ * @param o the other object
321+ * @return true iff both objects are equal or represent the same data
322+ */
318323 public boolean equals (final Object o ) {
319324 if (o == this ) {
320325 return true ;
@@ -326,6 +331,10 @@ public boolean equals(final Object o) {
326331 return innerObject .equals (other .innerObject );
327332 }
328333
334+ /**
335+ * Returns the `hashCode` of the underlying data, or 0 if {@link Value#isNull()} returns true.
336+ * @return the hash code
337+ */
329338 public int hashCode () {
330339 if (innerObject == null ) {
331340 return 0 ;
Original file line number Diff line number Diff line change 88class ImmutableMetadataTest {
99 @ Test
1010 void unequalImmutableMetadataAreUnequal () {
11- ImmutableMetadata i1 = ImmutableMetadata .builder ().addString ("key1" , "value1" ).build ();
12- ImmutableMetadata i2 = ImmutableMetadata .builder ().addString ("key1" , "value2" ).build ();
11+ ImmutableMetadata i1 =
12+ ImmutableMetadata .builder ().addString ("key1" , "value1" ).build ();
13+ ImmutableMetadata i2 =
14+ ImmutableMetadata .builder ().addString ("key1" , "value2" ).build ();
1315
1416 assertNotEquals (i1 , i2 );
1517 }
1618
1719 @ Test
1820 void equalImmutableMetadataAreEqual () {
19- ImmutableMetadata i1 = ImmutableMetadata .builder ().addString ("key1" , "value1" ).build ();
20- ImmutableMetadata i2 = ImmutableMetadata .builder ().addString ("key1" , "value1" ).build ();
21+ ImmutableMetadata i1 =
22+ ImmutableMetadata .builder ().addString ("key1" , "value1" ).build ();
23+ ImmutableMetadata i2 =
24+ ImmutableMetadata .builder ().addString ("key1" , "value1" ).build ();
2125
2226 assertEquals (i1 , i2 );
2327 }
Original file line number Diff line number Diff line change 77import static org .junit .jupiter .api .Assertions .assertTrue ;
88import static org .junit .jupiter .api .Assertions .fail ;
99
10- import java .lang .reflect .Modifier ;
1110import java .time .Instant ;
1211import java .util .ArrayList ;
1312import java .util .List ;
You can’t perform that action at this time.
0 commit comments