@@ -2903,6 +2903,48 @@ null, singletonMap("module-alpha", mapper.createObjectNode()), null))
29032903 }));
29042904 }
29052905
2906+ @ Test
2907+ public void shouldExecuteAuctionResponseHooksAndTolerateNullAccount (VertxTestContext context ) {
2908+ // given
2909+ final AuctionResponseHookImpl hookImpl = spy (
2910+ AuctionResponseHookImpl .of (immediateHook (InvocationResultUtils .succeeded (identity ()))));
2911+ given (hookCatalog .hookById (eqHook ("module-alpha" , "hook-a" ), eq (StageWithHookType .AUCTION_RESPONSE )))
2912+ .willReturn (hookImpl );
2913+
2914+ final HookStageExecutor executor = createExecutor (
2915+ executionPlan (singletonMap (
2916+ Endpoint .openrtb2_auction ,
2917+ EndpointExecutionPlan .of (singletonMap (
2918+ Stage .auction_response , execPlanOneGroupOneHook ("module-alpha" , "hook-a" ))))));
2919+
2920+ final HookExecutionContext hookExecutionContext = HookExecutionContext .of (Endpoint .openrtb2_auction );
2921+
2922+ // when
2923+ final Future <HookStageExecutionResult <AuctionResponsePayload >> future = executor .executeAuctionResponseStage (
2924+ BidResponse .builder ().build (),
2925+ AuctionContext .builder ()
2926+ .bidRequest (BidRequest .builder ().build ())
2927+ .account (null )
2928+ .hookExecutionContext (hookExecutionContext )
2929+ .debugContext (DebugContext .empty ())
2930+ .build ());
2931+
2932+ // then
2933+ future .onComplete (context .succeeding (result -> {
2934+ final ArgumentCaptor <AuctionInvocationContext > invocationContextCaptor =
2935+ ArgumentCaptor .forClass (AuctionInvocationContext .class );
2936+ verify (hookImpl ).call (any (), invocationContextCaptor .capture ());
2937+
2938+ assertThat (invocationContextCaptor .getValue ()).satisfies (invocationContext -> {
2939+ assertThat (invocationContext .endpoint ()).isNotNull ();
2940+ assertThat (invocationContext .timeout ()).isNotNull ();
2941+ assertThat (invocationContext .accountConfig ()).isNull ();
2942+ });
2943+
2944+ context .completeNow ();
2945+ }));
2946+ }
2947+
29062948 @ Test
29072949 public void shouldExecuteAuctionResponseHooksAndIgnoreRejection (VertxTestContext context ) {
29082950 // given
0 commit comments