88
99import dev .openfeature .sdk .fixtures .HookFixtures ;
1010import java .util .Arrays ;
11- import java .util .Collections ;
1211import java .util .HashMap ;
1312import java .util .List ;
1413import java .util .Map ;
@@ -35,11 +34,8 @@ void shouldMergeEvaluationContextsOnBeforeHooksCorrectly() {
3534 when (hook2 .before (any (), any ())).thenReturn (Optional .of (evaluationContextWithValue ("foo" , "bar" )));
3635
3736 var hookSupportData = new HookSupportData ();
38- hookSupportData .initialize (
39- Arrays .asList (hook1 , hook2 ),
40- getBaseHookContextForType (FlagValueType .STRING ),
41- baseContext ,
42- Collections .emptyMap ());
37+ hookSupportData .setHooks (
38+ Arrays .asList (hook1 , hook2 ), getBaseHookContextForType (FlagValueType .STRING ), baseContext );
4339
4440 hookSupport .executeBeforeHooks (hookSupportData );
4541
@@ -57,11 +53,8 @@ void shouldAlwaysCallGenericHook(FlagValueType flagValueType) {
5753 Hook <?> genericHook = mockGenericHook ();
5854
5955 var hookSupportData = new HookSupportData ();
60- hookSupportData .initialize (
61- List .of (genericHook ),
62- getBaseHookContextForType (flagValueType ),
63- ImmutableContext .EMPTY ,
64- Collections .emptyMap ());
56+ hookSupportData .setHooks (
57+ List .of (genericHook ), getBaseHookContextForType (flagValueType ), ImmutableContext .EMPTY );
6558
6659 callAllHooks (hookSupportData );
6760
@@ -77,11 +70,7 @@ void shouldAlwaysCallGenericHook(FlagValueType flagValueType) {
7770 void shouldPassDataAcrossStages (FlagValueType flagValueType ) {
7871 var testHook = new TestHookWithData ();
7972 var hookSupportData = new HookSupportData ();
80- hookSupportData .initialize (
81- List .of (testHook ),
82- getBaseHookContextForType (flagValueType ),
83- ImmutableContext .EMPTY ,
84- Collections .emptyMap ());
73+ hookSupportData .setHooks (List .of (testHook ), getBaseHookContextForType (flagValueType ), ImmutableContext .EMPTY );
8574
8675 hookSupport .executeBeforeHooks (hookSupportData );
8776 assertHookData (testHook , "before" );
@@ -106,11 +95,8 @@ void shouldIsolateDataBetweenHooks(FlagValueType flagValueType) {
10695 var testHook2 = new TestHookWithData (2 );
10796
10897 var hookSupportData = new HookSupportData ();
109- hookSupportData .initialize (
110- List .of (testHook1 , testHook2 ),
111- getBaseHookContextForType (flagValueType ),
112- ImmutableContext .EMPTY ,
113- Collections .emptyMap ());
98+ hookSupportData .setHooks (
99+ List .of (testHook1 , testHook2 ), getBaseHookContextForType (flagValueType ), ImmutableContext .EMPTY );
114100
115101 callAllHooks (hookSupportData );
116102
0 commit comments