Skip to content

Commit e1c0d94

Browse files
committed
Tests for api level hooks
1 parent 8bdba67 commit e1c0d94

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

lib/src/test/java/javasdk/FlagEvaluationSpecTests.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,18 @@ Client _client() {
3838
@Specification(spec="flag evaluation", number="1.3", text="The API MUST provide a function to add hooks which " +
3939
"accepts one or more API-conformant hooks, and appends them to the collection of any previously added hooks." +
4040
"When new hooks are added, previously added hooks are not removed.")
41-
@Disabled @Test void hook_addition() {
42-
throw new NotImplementedException();
41+
@Test void hook_addition() {
42+
Hook h1 = mock(Hook.class);
43+
Hook h2 = mock(Hook.class);
44+
OpenFeatureAPI api = OpenFeatureAPI.getInstance();
45+
api.registerHooks(h1);
46+
47+
assertEquals(1, api.getApiHooks().size());
48+
assertEquals(h1, api.getApiHooks().get(0));
49+
50+
api.registerHooks(h2);
51+
assertEquals(2, api.getApiHooks().size());
52+
assertEquals(h2, api.getApiHooks().get(1));
4353
}
4454

4555
@Specification(spec="flag evaluation", number="1.5", text="The API MUST provide a function for creating a client " +
@@ -160,7 +170,7 @@ Client _client() {
160170
@Specification(spec="flag evaluation", number="1.21", text="The client MUST transform the evaluation context using " +
161171
"the provider's context transformer function, before passing the result of the transformation to the " +
162172
"provider's flag resolution functions.")
163-
void todo() {}
173+
@Test @Disabled void todo() {}
164174

165175
@Specification(spec="flag evaluation", number="1.20", text="The client SHOULD provide asynchronous or non-blocking " +
166176
"mechanisms for flag evaluation.")

0 commit comments

Comments
 (0)