@@ -167,9 +167,9 @@ public void callShouldFilterBiddersWhenPartnerActivatedInBidRequest()
167167 final BidRequest bidRequest = givenBidRequestWithExtension (identity (), List .of (imp ));
168168 final AuctionContext auctionContext = givenAuctionContext (
169169 bidRequest ,
170- context -> context ,
171- explorationRate );
172- final AuctionInvocationContext invocationContext = givenAuctionInvocationContext ( auctionContext );
170+ context -> context );
171+ final AuctionInvocationContext invocationContext = givenAuctionInvocationContext (
172+ auctionContext , explorationRate );
173173 when (invocationContext .auctionContext ()).thenReturn (auctionContext );
174174 when (modelCacheWithExpiration .getIfPresent ("onnxModelRunner_test-pbuid" ))
175175 .thenReturn (givenOnnxModelRunner ());
@@ -229,8 +229,9 @@ public void callShouldNotFilterBiddersAndReturnAnalyticsTagWhenExploration() thr
229229 final Double explorationRate = 1.0 ;
230230 final Device device = givenDevice (identity ());
231231 final BidRequest bidRequest = givenBidRequest (request -> request , List .of (imp ), device );
232- final AuctionContext auctionContext = givenAuctionContext (bidRequest , context -> context , explorationRate );
233- final AuctionInvocationContext invocationContext = givenAuctionInvocationContext (auctionContext );
232+ final AuctionContext auctionContext = givenAuctionContext (bidRequest , context -> context );
233+ final AuctionInvocationContext invocationContext = givenAuctionInvocationContext (
234+ auctionContext , explorationRate );
234235 when (invocationContext .auctionContext ()).thenReturn (auctionContext );
235236 when (modelCacheWithExpiration .getIfPresent ("onnxModelRunner_test-pbuid" ))
236237 .thenReturn (givenOnnxModelRunner ());
@@ -282,8 +283,9 @@ public void callShouldFilterBiddersBasedOnModelWhenAnyFeatureNotAvailable() thro
282283 final Double explorationRate = 0.0001 ;
283284 final Device device = givenDeviceWithoutUserAgent (identity ());
284285 final BidRequest bidRequest = givenBidRequest (request -> request , List .of (imp ), device );
285- final AuctionContext auctionContext = givenAuctionContext (bidRequest , context -> context , explorationRate );
286- final AuctionInvocationContext invocationContext = givenAuctionInvocationContext (auctionContext );
286+ final AuctionContext auctionContext = givenAuctionContext (bidRequest , context -> context );
287+ final AuctionInvocationContext invocationContext = givenAuctionInvocationContext (
288+ auctionContext , explorationRate );
287289 when (invocationContext .auctionContext ()).thenReturn (auctionContext );
288290 when (modelCacheWithExpiration .getIfPresent ("onnxModelRunner_test-pbuid" ))
289291 .thenReturn (givenOnnxModelRunner ());
@@ -342,8 +344,9 @@ public void callShouldFilterBiddersBasedOnModelResults() throws OrtException, IO
342344 final Double explorationRate = 0.0001 ;
343345 final Device device = givenDevice (identity ());
344346 final BidRequest bidRequest = givenBidRequest (request -> request , List .of (imp ), device );
345- final AuctionContext auctionContext = givenAuctionContext (bidRequest , context -> context , explorationRate );
346- final AuctionInvocationContext invocationContext = givenAuctionInvocationContext (auctionContext );
347+ final AuctionContext auctionContext = givenAuctionContext (bidRequest , context -> context );
348+ final AuctionInvocationContext invocationContext = givenAuctionInvocationContext (
349+ auctionContext , explorationRate );
347350 when (invocationContext .auctionContext ()).thenReturn (auctionContext );
348351 when (modelCacheWithExpiration .getIfPresent ("onnxModelRunner_test-pbuid" ))
349352 .thenReturn (givenOnnxModelRunner ());
@@ -391,38 +394,30 @@ public void callShouldFilterBiddersBasedOnModelResults() throws OrtException, IO
391394
392395 private AuctionContext givenAuctionContext (
393396 BidRequest bidRequest ,
394- UnaryOperator <AuctionContext .AuctionContextBuilder > auctionContextCustomizer ,
395- Double explorationRate ) {
397+ UnaryOperator <AuctionContext .AuctionContextBuilder > auctionContextCustomizer ) {
396398
397399 final AuctionContext .AuctionContextBuilder auctionContextBuilder = AuctionContext .builder ()
398400 .httpRequest (HttpRequestContext .builder ().build ())
399- .bidRequest (bidRequest )
400- .account (givenAccount (explorationRate ));
401+ .bidRequest (bidRequest );
401402
402403 return auctionContextCustomizer .apply (auctionContextBuilder ).build ();
403404 }
404405
405- private AuctionInvocationContext givenAuctionInvocationContext (AuctionContext auctionContext ) {
406+ private AuctionInvocationContext givenAuctionInvocationContext (
407+ AuctionContext auctionContext , Double explorationRate ) {
406408 final AuctionInvocationContext invocationContext = mock (AuctionInvocationContext .class );
407409 when (invocationContext .auctionContext ()).thenReturn (auctionContext );
410+ when (invocationContext .accountConfig ()).thenReturn (givenAccountConfig (explorationRate ));
408411 return invocationContext ;
409412 }
410413
411- private Account givenAccount (Double explorationRate ) {
412- return Account .builder ()
413- .id ("test-account" )
414- .hooks (givenAccountHooksConfiguration (explorationRate ))
415- .build ();
416- }
417-
418- private AccountHooksConfiguration givenAccountHooksConfiguration (Double explorationRate ) {
414+ private ObjectNode givenAccountConfig (Double explorationRate ) {
419415 final ObjectNode greenbidsNode = TestBidRequestProvider .MAPPER .createObjectNode ();
420416 greenbidsNode .put ("enabled" , true );
421417 greenbidsNode .put ("pbuid" , "test-pbuid" );
422- greenbidsNode .put ("targetTpr" , 0.60 );
423- greenbidsNode .put ("explorationRate" , explorationRate );
424- final Map <String , ObjectNode > modules = Map .of ("greenbids" , greenbidsNode );
425- return AccountHooksConfiguration .of (null , modules , null );
418+ greenbidsNode .put ("target-tpr" , 0.60 );
419+ greenbidsNode .put ("exploration-rate" , explorationRate );
420+ return greenbidsNode ;
426421 }
427422
428423 private OnnxModelRunner givenOnnxModelRunner () throws OrtException , IOException {
0 commit comments