@@ -512,7 +512,8 @@ public void makeBidsShouldReplacePriceMacroInNurlAndAdmWithBidPrice() throws Jso
512
512
.impid ("123" )
513
513
.price (BigDecimal .valueOf (1.23 ))
514
514
.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" )));
516
517
517
518
// when
518
519
final Result <List <BidderBid >> result = target .makeBids (httpCall , null );
@@ -521,8 +522,9 @@ public void makeBidsShouldReplacePriceMacroInNurlAndAdmWithBidPrice() throws Jso
521
522
assertThat (result .getErrors ()).isEmpty ();
522
523
assertThat (result .getValue ()).hasSize (1 )
523
524
.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 )));
526
528
}
527
529
528
530
@ Test
@@ -534,7 +536,8 @@ public void makeBidsShouldReplacePriceMacroWithZeroWhenBidPriceIsNull() throws J
534
536
.impid ("123" )
535
537
.price (null )
536
538
.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" )));
538
541
539
542
// when
540
543
final Result <List <BidderBid >> result = target .makeBids (httpCall , null );
@@ -543,8 +546,9 @@ public void makeBidsShouldReplacePriceMacroWithZeroWhenBidPriceIsNull() throws J
543
546
assertThat (result .getErrors ()).isEmpty ();
544
547
assertThat (result .getValue ()).hasSize (1 )
545
548
.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" ));
548
552
}
549
553
550
554
@ Test
@@ -556,7 +560,8 @@ public void makeBidsShouldReplacePriceMacroWithZeroWhenBidPriceIsZero() throws J
556
560
.impid ("123" )
557
561
.price (BigDecimal .ZERO )
558
562
.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" )));
560
565
561
566
// when
562
567
final Result <List <BidderBid >> result = target .makeBids (httpCall , null );
@@ -565,8 +570,9 @@ public void makeBidsShouldReplacePriceMacroWithZeroWhenBidPriceIsZero() throws J
565
570
assertThat (result .getErrors ()).isEmpty ();
566
571
assertThat (result .getValue ()).hasSize (1 )
567
572
.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" ));
570
576
}
571
577
572
578
@ Test
@@ -578,7 +584,8 @@ public void makeBidsShouldReplacePriceMacroInNurlOnlyWhenAdmDoesNotContainMacro(
578
584
.impid ("123" )
579
585
.price (BigDecimal .valueOf (5.67 ))
580
586
.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" )));
582
589
583
590
// when
584
591
final Result <List <BidderBid >> result = target .makeBids (httpCall , null );
@@ -587,8 +594,9 @@ public void makeBidsShouldReplacePriceMacroInNurlOnlyWhenAdmDoesNotContainMacro(
587
594
assertThat (result .getErrors ()).isEmpty ();
588
595
assertThat (result .getValue ()).hasSize (1 )
589
596
.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" ));
592
600
}
593
601
594
602
@ Test
@@ -600,7 +608,8 @@ public void makeBidsShouldReplacePriceMacroInAdmOnlyWhenNurlDoesNotContainMacro(
600
608
.impid ("123" )
601
609
.price (BigDecimal .valueOf (8.90 ))
602
610
.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" )));
604
613
605
614
// when
606
615
final Result <List <BidderBid >> result = target .makeBids (httpCall , null );
@@ -609,8 +618,9 @@ public void makeBidsShouldReplacePriceMacroInAdmOnlyWhenNurlDoesNotContainMacro(
609
618
assertThat (result .getErrors ()).isEmpty ();
610
619
assertThat (result .getValue ()).hasSize (1 )
611
620
.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" ));
614
624
}
615
625
616
626
@ Test
@@ -622,7 +632,8 @@ public void makeBidsShouldNotReplacePriceMacroWhenNurlAndAdmDoNotContainMacro()
622
632
.impid ("123" )
623
633
.price (BigDecimal .valueOf (12.34 ))
624
634
.nurl ("http://example.com/nurl" )
625
- .adm ("<div>No macro</div>" )));
635
+ .adm ("<div>No macro</div>" )
636
+ .burl ("http://example.com/burl" )));
626
637
627
638
// when
628
639
final Result <List <BidderBid >> result = target .makeBids (httpCall , null );
@@ -631,8 +642,9 @@ public void makeBidsShouldNotReplacePriceMacroWhenNurlAndAdmDoNotContainMacro()
631
642
assertThat (result .getErrors ()).isEmpty ();
632
643
assertThat (result .getValue ()).hasSize (1 )
633
644
.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" ));
636
648
}
637
649
638
650
@ Test
@@ -644,7 +656,8 @@ public void makeBidsShouldHandleNullNurlAndAdm() throws JsonProcessingException
644
656
.impid ("123" )
645
657
.price (BigDecimal .valueOf (15.00 ))
646
658
.nurl (null )
647
- .adm (null )));
659
+ .adm (null )
660
+ .burl (null )));
648
661
649
662
// when
650
663
final Result <List <BidderBid >> result = target .makeBids (httpCall , null );
@@ -653,8 +666,8 @@ public void makeBidsShouldHandleNullNurlAndAdm() throws JsonProcessingException
653
666
assertThat (result .getErrors ()).isEmpty ();
654
667
assertThat (result .getValue ()).hasSize (1 )
655
668
.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 ));
658
671
}
659
672
660
673
@ Test
@@ -666,7 +679,8 @@ public void makeBidsShouldReplaceMultiplePriceMacrosInSameField() throws JsonPro
666
679
.impid ("123" )
667
680
.price (BigDecimal .valueOf (9.99 ))
668
681
.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" )));
670
684
671
685
// when
672
686
final Result <List <BidderBid >> result = target .makeBids (httpCall , null );
@@ -675,8 +689,11 @@ public void makeBidsShouldReplaceMultiplePriceMacrosInSameField() throws JsonPro
675
689
assertThat (result .getErrors ()).isEmpty ();
676
690
assertThat (result .getValue ()).hasSize (1 )
677
691
.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" ));
680
697
}
681
698
682
699
@ Test
@@ -688,7 +705,8 @@ public void makeBidsShouldHandleLargeDecimalPrices() throws JsonProcessingExcept
688
705
.impid ("123" )
689
706
.price (new BigDecimal ("123456789.123456789" ))
690
707
.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" )));
692
710
693
711
// when
694
712
final Result <List <BidderBid >> result = target .makeBids (httpCall , null );
@@ -697,8 +715,37 @@ public void makeBidsShouldHandleLargeDecimalPrices() throws JsonProcessingExcept
697
715
assertThat (result .getErrors ()).isEmpty ();
698
716
assertThat (result .getValue ()).hasSize (1 )
699
717
.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" ));
702
749
}
703
750
704
751
private String givenBidResponse (UnaryOperator <Bid .BidBuilder > bidCustomizer ) throws JsonProcessingException {
0 commit comments