1
1
package dev .openfeature .sdk ;
2
2
3
3
import static org .assertj .core .api .Assertions .assertThat ;
4
+ import static org .junit .jupiter .api .Assertions .assertFalse ;
5
+ import static org .junit .jupiter .api .Assertions .assertTrue ;
4
6
5
7
import org .junit .jupiter .api .DisplayName ;
6
8
import org .junit .jupiter .api .Test ;
@@ -9,7 +11,7 @@ class FlagMetadataTest {
9
11
10
12
@ Test
11
13
@ DisplayName ("Test metadata payload construction and retrieval" )
12
- public void builder_validation () {
14
+ void builder_validation () {
13
15
// given
14
16
ImmutableMetadata flagMetadata = ImmutableMetadata .builder ()
15
17
.addString ("string" , "string" )
@@ -42,7 +44,7 @@ public void builder_validation() {
42
44
43
45
@ Test
44
46
@ DisplayName ("Value type mismatch returns a null" )
45
- public void value_type_validation () {
47
+ void value_type_validation () {
46
48
// given
47
49
ImmutableMetadata flagMetadata =
48
50
ImmutableMetadata .builder ().addString ("string" , "string" ).build ();
@@ -53,11 +55,32 @@ public void value_type_validation() {
53
55
54
56
@ Test
55
57
@ DisplayName ("A null is returned if key does not exist" )
56
- public void notfound_error_validation () {
58
+ void notfound_error_validation () {
57
59
// given
58
60
ImmutableMetadata flagMetadata = ImmutableMetadata .builder ().build ();
59
61
60
62
// then
61
63
assertThat (flagMetadata .getBoolean ("string" )).isNull ();
62
64
}
65
+
66
+ @ Test
67
+ @ DisplayName ("isEmpty returns true iff the metadata is empty" )
68
+ void isEmpty_returns_true_if_metadata_is_empty () {
69
+ // given
70
+ ImmutableMetadata flagMetadata = ImmutableMetadata .builder ().build ();
71
+
72
+ // then
73
+ assertTrue (flagMetadata .isEmpty ());
74
+ }
75
+
76
+ @ Test
77
+ @ DisplayName ("isEmpty returns false iff the metadata is not empty" )
78
+ void isEmpty_returns_false_if_metadata_is_not_empty () {
79
+ // given
80
+ ImmutableMetadata flagMetadata =
81
+ ImmutableMetadata .builder ().addString ("a" , "b" ).build ();
82
+
83
+ // then
84
+ assertFalse (flagMetadata .isEmpty ());
85
+ }
63
86
}
0 commit comments