You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/src/test/java/dev/openfeature/javasdk/HookSpecTests.java
+16-10Lines changed: 16 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,6 @@
1
1
packagedev.openfeature.javasdk;
2
2
3
3
importcom.google.common.collect.ImmutableMap;
4
-
importdev.openfeature.javasdk.*;
5
4
importlombok.SneakyThrows;
6
5
importorg.junit.jupiter.api.AfterEach;
7
6
importorg.junit.jupiter.api.Disabled;
@@ -11,6 +10,7 @@
11
10
importjava.util.ArrayList;
12
11
importjava.util.Arrays;
13
12
importjava.util.List;
13
+
importjava.util.Optional;
14
14
15
15
importstaticorg.junit.jupiter.api.Assertions.*;
16
16
importstaticorg.mockito.ArgumentMatchers.any;
@@ -140,7 +140,7 @@ void emptyApiHooks() {
140
140
.build();
141
141
}
142
142
143
-
@Specification(spec="hooks", number="3.2", text="The before stage MUST run before flag evaluation occurs. It accepts a hook context (required) and HookHints (optional) as parameters and returns either a HookContext or nothing.")
143
+
@Specification(spec="hooks", number="3.2", text="The before stage MUST run before flag evaluation occurs. It accepts a hook context (required) and HookHints (optional) as parameters and returns either a EvaluationContext or nothing.")
144
144
@Testvoidbefore_runs_ahead_of_evaluation() {
145
145
OpenFeatureAPIapi = OpenFeatureAPI.getInstance();
146
146
api.setProvider(newAlwaysBrokenProvider());
@@ -175,7 +175,7 @@ void emptyApiHooks() {
175
175
verify(h, times(0)).error(any(), any(), any());
176
176
}
177
177
178
-
@Specification(spec="hooks", number="3.4", text="The error hook MUST run when errors are encountered in the before stage, the after stage or during flag evaluation. It accepts hook context (required), exception for what went wrong (required), and HookHints (optional). It has no return value.")
178
+
@Specification(spec="hooks", number="3.6", text="The error hook MUST run when errors are encountered in the before stage, the after stage or during flag evaluation. It accepts hook context (required), exception for what went wrong (required), and HookHints (optional). It has no return value.")
@@ -332,8 +336,8 @@ public void finallyAfter(HookContext<Boolean> ctx, ImmutableMap<String, Object>
332
336
assertTrue(feo.getHookHints().isEmpty());
333
337
}
334
338
335
-
@Specification(spec="hooks", number="3.3", text="The after stage MUST run after flag evaluation occurs. It accepts a hook context (required), flag evaluation details (required) and HookHints (optional). It has no return value.")
336
-
@Specification(spec="hooks", number="3.5", text="The finally hook MUST run after the before, after, and error stages. It accepts a hook context (required) and HookHints (optional). There is no return value.")
339
+
@Specification(spec="hooks", number="3.5", text="The after stage MUST run after flag evaluation occurs. It accepts a hook context (required), flag evaluation details (required) and HookHints (optional). It has no return value.")
340
+
@Specification(spec="hooks", number="3.7", text="The finally hook MUST run after the before, after, and error stages. It accepts a hook context (required) and HookHints (optional). There is no return value.")
@Specification(spec="hooks", number="3.3", text="Any `EvaluationContext` returned from a `before` hook **MUST** be passed to subsequent `before` hooks (via `HookContext`).")
399
+
@Specification(spec="hooks", number="3.4", text="When `before` hooks have finished executing, any resulting `EvaluationContext` **MUST** be merged with the invocation `EvaluationContext` wherein the invocation `EvaluationContext` win any conflicts.")
394
400
@Specification(spec="hooks", number="1.4", text="The evaluation context MUST be mutable only within the before hook.")
395
401
@Specification(spec="hooks", number="3.1", text="Hooks MUST specify at least one stage.")
396
402
@Test@Disabledvoidtodo() {}
397
403
398
404
@SneakyThrows
399
-
@Specification(spec="hooks", number="3.6", text="Condition: If finally is a reserved word in the language, finallyAfter SHOULD be used.")
405
+
@Specification(spec="hooks", number="3.8", text="Condition: If finally is a reserved word in the language, finallyAfter SHOULD be used.")
0 commit comments