@@ -26,16 +26,18 @@ class HookSupportTest implements HookFixtures {
2626 void shouldMergeEvaluationContextsOnBeforeHooksCorrectly () {
2727 Map <String , Value > attributes = new HashMap <>();
2828 attributes .put ("baseKey" , new Value ("baseValue" ));
29- EvaluationContext baseContext = new ImmutableContext (attributes );
29+ EvaluationContext baseEvalContext = new ImmutableContext (attributes );
3030
3131 Hook <String > hook1 = mockStringHook ();
3232 Hook <String > hook2 = mockStringHook ();
3333 when (hook1 .before (any (), any ())).thenReturn (Optional .of (evaluationContextWithValue ("bla" , "blubber" )));
3434 when (hook2 .before (any (), any ())).thenReturn (Optional .of (evaluationContextWithValue ("foo" , "bar" )));
3535
36+ var sharedContext = getBaseHookContextForType (FlagValueType .STRING );
3637 var hookSupportData = new HookSupportData ();
37- hookSupportData .setHooks (
38- Arrays .asList (hook1 , hook2 ), getBaseHookContextForType (FlagValueType .STRING ), baseContext );
38+ hookSupport .setHookSupportDataHooks (hookSupportData ,
39+ Arrays .asList (hook1 , hook2 ), sharedContext , baseEvalContext );
40+ hookSupport .updateEvaluationContext (hookSupportData , baseEvalContext );
3941
4042 hookSupport .executeBeforeHooks (hookSupportData );
4143
@@ -53,7 +55,7 @@ void shouldAlwaysCallGenericHook(FlagValueType flagValueType) {
5355 Hook <?> genericHook = mockGenericHook ();
5456
5557 var hookSupportData = new HookSupportData ();
56- hookSupportData . setHooks (
58+ hookSupport . setHookSupportDataHooks ( hookSupportData ,
5759 List .of (genericHook ), getBaseHookContextForType (flagValueType ), ImmutableContext .EMPTY );
5860
5961 callAllHooks (hookSupportData );
@@ -70,7 +72,8 @@ void shouldAlwaysCallGenericHook(FlagValueType flagValueType) {
7072 void shouldPassDataAcrossStages (FlagValueType flagValueType ) {
7173 var testHook = new TestHookWithData ();
7274 var hookSupportData = new HookSupportData ();
73- hookSupportData .setHooks (List .of (testHook ), getBaseHookContextForType (flagValueType ), ImmutableContext .EMPTY );
75+ hookSupport .setHookSupportDataHooks (hookSupportData ,
76+ List .of (testHook ), getBaseHookContextForType (flagValueType ), ImmutableContext .EMPTY );
7477
7578 hookSupport .executeBeforeHooks (hookSupportData );
7679 assertHookData (testHook , "before" );
@@ -95,7 +98,7 @@ void shouldIsolateDataBetweenHooks(FlagValueType flagValueType) {
9598 var testHook2 = new TestHookWithData (2 );
9699
97100 var hookSupportData = new HookSupportData ();
98- hookSupportData . setHooks (
101+ hookSupport . setHookSupportDataHooks ( hookSupportData ,
99102 List .of (testHook1 , testHook2 ), getBaseHookContextForType (flagValueType ), ImmutableContext .EMPTY );
100103
101104 callAllHooks (hookSupportData );
0 commit comments