@@ -512,7 +512,8 @@ public void makeBidsShouldReplacePriceMacroInNurlAndAdmWithBidPrice() throws Jso
512512 .impid ("123" )
513513 .price (BigDecimal .valueOf (1.23 ))
514514 .nurl ("http://example.com/nurl?price=${AUCTION_PRICE}" )
515- .adm ("<div>Price: ${AUCTION_PRICE}</div>" )));
515+ .adm ("<div>Price: ${AUCTION_PRICE}</div>" )
516+ .burl ("https://adsrvr.org/feedback/xxx?wp=${AUCTION_PRICE}¶m2=xyz" )));
516517
517518 // when
518519 final Result <List <BidderBid >> result = target .makeBids (httpCall , null );
@@ -521,8 +522,9 @@ public void makeBidsShouldReplacePriceMacroInNurlAndAdmWithBidPrice() throws Jso
521522 assertThat (result .getErrors ()).isEmpty ();
522523 assertThat (result .getValue ()).hasSize (1 )
523524 .extracting (BidderBid ::getBid )
524- .extracting (Bid ::getNurl , Bid ::getAdm , Bid ::getPrice )
525- .containsOnly (tuple ("http://example.com/nurl?price=1.23" , "<div>Price: 1.23</div>" , BigDecimal .valueOf (1.23 )));
525+ .extracting (Bid ::getNurl , Bid ::getAdm , Bid ::getBurl , Bid ::getPrice )
526+ .containsOnly (tuple ("http://example.com/nurl?price=1.23" , "<div>Price: 1.23</div>" ,
527+ "https://adsrvr.org/feedback/xxx?wp=1.23¶m2=xyz" , BigDecimal .valueOf (1.23 )));
526528 }
527529
528530 @ Test
@@ -534,7 +536,8 @@ public void makeBidsShouldReplacePriceMacroWithZeroWhenBidPriceIsNull() throws J
534536 .impid ("123" )
535537 .price (null )
536538 .nurl ("http://example.com/nurl?price=${AUCTION_PRICE}" )
537- .adm ("<div>Price: ${AUCTION_PRICE}</div>" )));
539+ .adm ("<div>Price: ${AUCTION_PRICE}</div>" )
540+ .burl ("https://adsrvr.org/feedback/xxx?wp=${AUCTION_PRICE}¶m2=xyz" )));
538541
539542 // when
540543 final Result <List <BidderBid >> result = target .makeBids (httpCall , null );
@@ -543,8 +546,9 @@ public void makeBidsShouldReplacePriceMacroWithZeroWhenBidPriceIsNull() throws J
543546 assertThat (result .getErrors ()).isEmpty ();
544547 assertThat (result .getValue ()).hasSize (1 )
545548 .extracting (BidderBid ::getBid )
546- .extracting (Bid ::getNurl , Bid ::getAdm )
547- .containsOnly (tuple ("http://example.com/nurl?price=0" , "<div>Price: 0</div>" ));
549+ .extracting (Bid ::getNurl , Bid ::getAdm , Bid ::getBurl )
550+ .containsOnly (tuple ("http://example.com/nurl?price=0" , "<div>Price: 0</div>" ,
551+ "https://adsrvr.org/feedback/xxx?wp=0¶m2=xyz" ));
548552 }
549553
550554 @ Test
@@ -556,7 +560,8 @@ public void makeBidsShouldReplacePriceMacroWithZeroWhenBidPriceIsZero() throws J
556560 .impid ("123" )
557561 .price (BigDecimal .ZERO )
558562 .nurl ("http://example.com/nurl?price=${AUCTION_PRICE}" )
559- .adm ("<div>Price: ${AUCTION_PRICE}</div>" )));
563+ .adm ("<div>Price: ${AUCTION_PRICE}</div>" )
564+ .burl ("https://adsrvr.org/feedback/xxx?wp=${AUCTION_PRICE}¶m2=xyz" )));
560565
561566 // when
562567 final Result <List <BidderBid >> result = target .makeBids (httpCall , null );
@@ -565,8 +570,9 @@ public void makeBidsShouldReplacePriceMacroWithZeroWhenBidPriceIsZero() throws J
565570 assertThat (result .getErrors ()).isEmpty ();
566571 assertThat (result .getValue ()).hasSize (1 )
567572 .extracting (BidderBid ::getBid )
568- .extracting (Bid ::getNurl , Bid ::getAdm )
569- .containsOnly (tuple ("http://example.com/nurl?price=0" , "<div>Price: 0</div>" ));
573+ .extracting (Bid ::getNurl , Bid ::getAdm , Bid ::getBurl )
574+ .containsOnly (tuple ("http://example.com/nurl?price=0" , "<div>Price: 0</div>" ,
575+ "https://adsrvr.org/feedback/xxx?wp=0¶m2=xyz" ));
570576 }
571577
572578 @ Test
@@ -578,7 +584,8 @@ public void makeBidsShouldReplacePriceMacroInNurlOnlyWhenAdmDoesNotContainMacro(
578584 .impid ("123" )
579585 .price (BigDecimal .valueOf (5.67 ))
580586 .nurl ("http://example.com/nurl?price=${AUCTION_PRICE}" )
581- .adm ("<div>No macro here</div>" )));
587+ .adm ("<div>No macro here</div>" )
588+ .burl ("http://example.com/burl" )));
582589
583590 // when
584591 final Result <List <BidderBid >> result = target .makeBids (httpCall , null );
@@ -587,8 +594,9 @@ public void makeBidsShouldReplacePriceMacroInNurlOnlyWhenAdmDoesNotContainMacro(
587594 assertThat (result .getErrors ()).isEmpty ();
588595 assertThat (result .getValue ()).hasSize (1 )
589596 .extracting (BidderBid ::getBid )
590- .extracting (Bid ::getNurl , Bid ::getAdm )
591- .containsOnly (tuple ("http://example.com/nurl?price=5.67" , "<div>No macro here</div>" ));
597+ .extracting (Bid ::getNurl , Bid ::getAdm , Bid ::getBurl )
598+ .containsOnly (tuple ("http://example.com/nurl?price=5.67" , "<div>No macro here</div>" ,
599+ "http://example.com/burl" ));
592600 }
593601
594602 @ Test
@@ -600,7 +608,8 @@ public void makeBidsShouldReplacePriceMacroInAdmOnlyWhenNurlDoesNotContainMacro(
600608 .impid ("123" )
601609 .price (BigDecimal .valueOf (8.90 ))
602610 .nurl ("http://example.com/nurl" )
603- .adm ("<div>Price: ${AUCTION_PRICE}</div>" )));
611+ .adm ("<div>Price: ${AUCTION_PRICE}</div>" )
612+ .burl ("http://example.com/burl" )));
604613
605614 // when
606615 final Result <List <BidderBid >> result = target .makeBids (httpCall , null );
@@ -609,8 +618,9 @@ public void makeBidsShouldReplacePriceMacroInAdmOnlyWhenNurlDoesNotContainMacro(
609618 assertThat (result .getErrors ()).isEmpty ();
610619 assertThat (result .getValue ()).hasSize (1 )
611620 .extracting (BidderBid ::getBid )
612- .extracting (Bid ::getNurl , Bid ::getAdm )
613- .containsOnly (tuple ("http://example.com/nurl" , "<div>Price: 8.9</div>" ));
621+ .extracting (Bid ::getNurl , Bid ::getAdm , Bid ::getBurl )
622+ .containsOnly (tuple ("http://example.com/nurl" , "<div>Price: 8.9</div>" ,
623+ "http://example.com/burl" ));
614624 }
615625
616626 @ Test
@@ -622,7 +632,8 @@ public void makeBidsShouldNotReplacePriceMacroWhenNurlAndAdmDoNotContainMacro()
622632 .impid ("123" )
623633 .price (BigDecimal .valueOf (12.34 ))
624634 .nurl ("http://example.com/nurl" )
625- .adm ("<div>No macro</div>" )));
635+ .adm ("<div>No macro</div>" )
636+ .burl ("http://example.com/burl" )));
626637
627638 // when
628639 final Result <List <BidderBid >> result = target .makeBids (httpCall , null );
@@ -631,8 +642,9 @@ public void makeBidsShouldNotReplacePriceMacroWhenNurlAndAdmDoNotContainMacro()
631642 assertThat (result .getErrors ()).isEmpty ();
632643 assertThat (result .getValue ()).hasSize (1 )
633644 .extracting (BidderBid ::getBid )
634- .extracting (Bid ::getNurl , Bid ::getAdm )
635- .containsOnly (tuple ("http://example.com/nurl" , "<div>No macro</div>" ));
645+ .extracting (Bid ::getNurl , Bid ::getAdm , Bid ::getBurl )
646+ .containsOnly (tuple ("http://example.com/nurl" , "<div>No macro</div>" ,
647+ "http://example.com/burl" ));
636648 }
637649
638650 @ Test
@@ -644,7 +656,8 @@ public void makeBidsShouldHandleNullNurlAndAdm() throws JsonProcessingException
644656 .impid ("123" )
645657 .price (BigDecimal .valueOf (15.00 ))
646658 .nurl (null )
647- .adm (null )));
659+ .adm (null )
660+ .burl (null )));
648661
649662 // when
650663 final Result <List <BidderBid >> result = target .makeBids (httpCall , null );
@@ -653,8 +666,8 @@ public void makeBidsShouldHandleNullNurlAndAdm() throws JsonProcessingException
653666 assertThat (result .getErrors ()).isEmpty ();
654667 assertThat (result .getValue ()).hasSize (1 )
655668 .extracting (BidderBid ::getBid )
656- .extracting (Bid ::getNurl , Bid ::getAdm )
657- .containsOnly (tuple (null , null ));
669+ .extracting (Bid ::getNurl , Bid ::getAdm , Bid :: getBurl )
670+ .containsOnly (tuple (null , null , null ));
658671 }
659672
660673 @ Test
@@ -666,7 +679,8 @@ public void makeBidsShouldReplaceMultiplePriceMacrosInSameField() throws JsonPro
666679 .impid ("123" )
667680 .price (BigDecimal .valueOf (9.99 ))
668681 .nurl ("http://example.com/nurl?price=${AUCTION_PRICE}&backup_price=${AUCTION_PRICE}" )
669- .adm ("<div>Price: ${AUCTION_PRICE}, Fallback: ${AUCTION_PRICE}</div>" )));
682+ .adm ("<div>Price: ${AUCTION_PRICE}, Fallback: ${AUCTION_PRICE}</div>" )
683+ .burl ("https://adsrvr.org/feedback/xxx?wp=${AUCTION_PRICE}&backup_wp=${AUCTION_PRICE}¶m2=xyz" )));
670684
671685 // when
672686 final Result <List <BidderBid >> result = target .makeBids (httpCall , null );
@@ -675,8 +689,11 @@ public void makeBidsShouldReplaceMultiplePriceMacrosInSameField() throws JsonPro
675689 assertThat (result .getErrors ()).isEmpty ();
676690 assertThat (result .getValue ()).hasSize (1 )
677691 .extracting (BidderBid ::getBid )
678- .extracting (Bid ::getNurl , Bid ::getAdm )
679- .containsOnly (tuple ("http://example.com/nurl?price=9.99&backup_price=9.99" , "<div>Price: 9.99, Fallback: 9.99</div>" ));
692+ .extracting (Bid ::getNurl , Bid ::getAdm , Bid ::getBurl )
693+ .containsOnly (tuple (
694+ "http://example.com/nurl?price=9.99&backup_price=9.99" ,
695+ "<div>Price: 9.99, Fallback: 9.99</div>" ,
696+ "https://adsrvr.org/feedback/xxx?wp=9.99&backup_wp=9.99¶m2=xyz" ));
680697 }
681698
682699 @ Test
@@ -688,7 +705,8 @@ public void makeBidsShouldHandleLargeDecimalPrices() throws JsonProcessingExcept
688705 .impid ("123" )
689706 .price (new BigDecimal ("123456789.123456789" ))
690707 .nurl ("http://example.com/nurl?price=${AUCTION_PRICE}" )
691- .adm ("<div>Price: ${AUCTION_PRICE}</div>" )));
708+ .adm ("<div>Price: ${AUCTION_PRICE}</div>" )
709+ .burl ("https://adsrvr.org/feedback/xxx?wp=${AUCTION_PRICE}¶m2=xyz" )));
692710
693711 // when
694712 final Result <List <BidderBid >> result = target .makeBids (httpCall , null );
@@ -697,8 +715,37 @@ public void makeBidsShouldHandleLargeDecimalPrices() throws JsonProcessingExcept
697715 assertThat (result .getErrors ()).isEmpty ();
698716 assertThat (result .getValue ()).hasSize (1 )
699717 .extracting (BidderBid ::getBid )
700- .extracting (Bid ::getNurl , Bid ::getAdm )
701- .containsOnly (tuple ("http://example.com/nurl?price=123456789.123456789" , "<div>Price: 123456789.123456789</div>" ));
718+ .extracting (Bid ::getNurl , Bid ::getAdm , Bid ::getBurl )
719+ .containsOnly (tuple (
720+ "http://example.com/nurl?price=123456789.123456789" ,
721+ "<div>Price: 123456789.123456789</div>" ,
722+ "https://adsrvr.org/feedback/xxx?wp=123456789.123456789¶m2=xyz" ));
723+ }
724+
725+ @ Test
726+ public void makeBidsShouldReplacePriceMacroInBurlIfNurlAndAdmDoNotContainMacro () throws JsonProcessingException {
727+ // given
728+ final BidderCall <BidRequest > httpCall = givenHttpCall (
729+ givenBidResponse (bidBuilder -> bidBuilder
730+ .mtype (1 )
731+ .impid ("123" )
732+ .price (BigDecimal .valueOf (7.77 ))
733+ .nurl ("http://example.com/nurl" )
734+ .adm ("<div>No macro</div>" )
735+ .burl ("https://adsrvr.org/feedback/xxx?wp=${AUCTION_PRICE}¶m2=xyz" )));
736+
737+ // when
738+ final Result <List <BidderBid >> result = target .makeBids (httpCall , null );
739+
740+ // then
741+ assertThat (result .getErrors ()).isEmpty ();
742+ assertThat (result .getValue ()).hasSize (1 )
743+ .extracting (BidderBid ::getBid )
744+ .extracting (Bid ::getNurl , Bid ::getAdm , Bid ::getBurl )
745+ .containsOnly (tuple (
746+ "http://example.com/nurl" ,
747+ "<div>No macro</div>" ,
748+ "https://adsrvr.org/feedback/xxx?wp=7.77¶m2=xyz" ));
702749 }
703750
704751 private String givenBidResponse (UnaryOperator <Bid .BidBuilder > bidCustomizer ) throws JsonProcessingException {
0 commit comments