@@ -280,6 +280,100 @@ public void maybeLogOpenrtb2AmpShouldNotLogIfSpecEndpointIsNotAmp() {
280280 verifyNoInteractions (logger );
281281 }
282282
283+ @ Test
284+ public void maybeLogOpenrtb2GetInterfaceShouldLogWithExpectedParams () {
285+ // given
286+ final AuctionContext givenAuctionContext =
287+ givenAuctionContext (accountBuilder -> accountBuilder .id ("123" ));
288+ final HttpLogSpec givenSpec = HttpLogSpec .of (null , null , "123" , null , 1 );
289+
290+ // when
291+ target .setSpec (givenSpec );
292+ target .maybeLogOpenrtb2GetInterface (givenAuctionContext , routingContext , 200 , "responseBody" );
293+
294+ // then
295+ verify (logger )
296+ .info ("Requested URL: \" {}\" , response status: \" {}\" , response body: \" {}\" " ,
297+ "example.com" ,
298+ 200 ,
299+ "responseBody" );
300+ }
301+
302+ @ Test
303+ public void maybeLogOpenrtb2GetInterfaceShouldLimitLogBySpecLimit () {
304+ // given
305+ final AuctionContext givenAuctionContext =
306+ givenAuctionContext (accountBuilder -> accountBuilder .id ("123" ));
307+ final HttpLogSpec givenSpec = HttpLogSpec .of (null , null , "123" , null , 1 );
308+
309+ // when
310+ target .setSpec (givenSpec );
311+ target .maybeLogOpenrtb2GetInterface (givenAuctionContext , routingContext , 200 , null );
312+ target .maybeLogOpenrtb2GetInterface (givenAuctionContext , routingContext , 200 , null );
313+
314+ // then
315+ verify (logger ).info (anyString (), anyString (), any (), any ());
316+ }
317+
318+ @ Test
319+ public void maybeLogOpenrtb2GetInterfaceShouldNotLogIfAccountIdNotEqualsToGivenInSpec () {
320+ // given
321+ final AuctionContext givenAuctionContext =
322+ givenAuctionContext (accountBuilder -> accountBuilder .id ("456" ));
323+ final HttpLogSpec givenSpec = HttpLogSpec .of (null , null , "123" , null , 1 );
324+
325+ // when
326+ target .setSpec (givenSpec );
327+ target .maybeLogOpenrtb2GetInterface (givenAuctionContext , routingContext , 200 , null );
328+
329+ // then
330+ verifyNoInteractions (logger );
331+ }
332+
333+ @ Test
334+ public void maybeLogOpenrtb2GetInterfaceShouldLogIfStatusEqualsToGivenInSpec () {
335+ // given
336+ final AuctionContext givenAuctionContext = givenAuctionContext (identity ());
337+ final HttpLogSpec givenSpec = HttpLogSpec .of (null , 501 , null , null , 1 );
338+
339+ // when
340+ target .setSpec (givenSpec );
341+ target .maybeLogOpenrtb2GetInterface (givenAuctionContext , routingContext , 200 , null );
342+ target .maybeLogOpenrtb2GetInterface (givenAuctionContext , routingContext , 501 , null );
343+
344+ // then
345+ verify (logger ).info (anyString (), anyString (), eq (501 ), any ());
346+ verify (logger , never ()).info (anyString (), anyString (), eq (200 ), any ());
347+ }
348+
349+ @ Test
350+ public void maybeLogOpenrtb2GetInterfaceShouldLogIfSpecEndpointIsGetInterface () {
351+ // given
352+ final AuctionContext givenAuctionContext = givenAuctionContext (identity ());
353+ final HttpLogSpec givenSpec = HttpLogSpec .of (HttpLogSpec .Endpoint .get_interface , null , null , null , 1 );
354+
355+ // when
356+ target .setSpec (givenSpec );
357+ target .maybeLogOpenrtb2GetInterface (givenAuctionContext , routingContext , 200 , null );
358+
359+ // then
360+ verify (logger ).info (anyString (), anyString (), any (), any ());
361+ }
362+
363+ @ Test
364+ public void maybeLogOpenrtb2GetInterfaceShouldNotLogIfSpecEndpointIsNotGetInterface () {
365+ // given
366+ final AuctionContext givenAuctionContext = givenAuctionContext (identity ());
367+ final HttpLogSpec givenSpec = HttpLogSpec .of (HttpLogSpec .Endpoint .auction , null , null , null , 1 );
368+
369+ // when
370+ target .setSpec (givenSpec );
371+ target .maybeLogOpenrtb2GetInterface (givenAuctionContext , routingContext , 200 , null );
372+
373+ // then
374+ verifyNoInteractions (logger );
375+ }
376+
283377 @ Test
284378 public void maybeLogBidderRequestShouldLogWithExpectedParams () {
285379 // given
0 commit comments