3636
3737public class MobilefuseBidderTest extends VertxTest {
3838
39- private static final String ENDPOINT_URL = "https://test.endpoint.com/openrtb?pub_id= " ;
39+ private static final String ENDPOINT_URL = "https://test.endpoint.com/openrtb" ;
4040
4141 private final MobilefuseBidder target = new MobilefuseBidder (ENDPOINT_URL , jacksonMapper );
4242
4343 private static Imp givenImp (Function <Imp .ImpBuilder , Imp .ImpBuilder > impCustomizer ) {
4444 return impCustomizer .apply (Imp .builder ()
4545 .id ("imp_id" )
4646 .ext (mapper .valueToTree (ExtPrebid .of (null ,
47- ExtImpMobilefuse .of (1 , 2 , "tagidSrc" )))))
47+ ExtImpMobilefuse .of (1 )))))
4848 .build ();
4949 }
5050
@@ -84,15 +84,18 @@ public void makeHttpRequestsShouldReturnErrorIfNoValidExtFound() {
8484 // given
8585 final BidRequest bidRequest = givenBidRequest (impBuilder -> impBuilder
8686 .id ("456" )
87- .banner (null )
87+ .banner (Banner . builder (). build () )
8888 .ext (mapper .valueToTree (ExtPrebid .of (null , mapper .createArrayNode ()))));
8989
9090 // when
9191 final Result <List <HttpRequest <BidRequest >>> result = target .makeHttpRequests (bidRequest );
9292
9393 // then
94- assertThat (result .getErrors ())
95- .containsExactly (BidderError .badInput ("Invalid ExtImpMobilefuse value" ));
94+ assertThat (result .getErrors ()).hasSize (1 )
95+ .allSatisfy (error -> {
96+ assertThat (error .getMessage ()).startsWith ("Error parsing ExtImpMobilefuse value:" );
97+ assertThat (error .getType ()).isEqualTo (BidderError .Type .bad_input );
98+ });
9699 assertThat (result .getValue ()).isEmpty ();
97100 }
98101
@@ -102,44 +105,6 @@ public void creationShouldFailOnInvalidEndpointUrl() {
102105 .isThrownBy (() -> new MobilefuseBidder ("invalid_url" , jacksonMapper ));
103106 }
104107
105- @ Test
106- public void makeHttpRequestsShouldCreateCorrectURLWhenTagidSrcEqualsExt () {
107- // given
108- final BidRequest bidRequest = givenBidRequest (
109- impBuilder -> impBuilder
110- .banner (Banner .builder ().build ())
111- .ext (mapper .valueToTree (ExtPrebid .of (null ,
112- ExtImpMobilefuse .of (1 , 2 , "ext" )))));
113-
114- // when
115- final Result <List <HttpRequest <BidRequest >>> result = target .makeHttpRequests (bidRequest );
116-
117- // then
118- assertThat (result .getErrors ()).isEmpty ();
119- assertThat (result .getValue ())
120- .extracting (HttpRequest ::getUri )
121- .containsExactly ("https://test.endpoint.com/openrtb?pub_id=2&tagid_src=ext" );
122- }
123-
124- @ Test
125- public void makeHttpRequestsShouldSetPubIdToZeroIfPublisherIdNotPresentInRequest () {
126- // given
127- final BidRequest bidRequest = givenBidRequest (
128- impBuilder -> impBuilder
129- .banner (Banner .builder ().build ())
130- .ext (mapper .valueToTree (ExtPrebid .of (null ,
131- ExtImpMobilefuse .of (1 , null , null )))));
132-
133- // when
134- final Result <List <HttpRequest <BidRequest >>> result = target .makeHttpRequests (bidRequest );
135-
136- // then
137- assertThat (result .getErrors ()).isEmpty ();
138- assertThat (result .getValue ())
139- .extracting (HttpRequest ::getUri )
140- .containsExactly ("https://test.endpoint.com/openrtb?pub_id=0" );
141- }
142-
143108 @ Test
144109 public void makeHttpRequestsShouldReturnErrorIfNoValidImpsFound () {
145110 // given
@@ -193,7 +158,7 @@ public void makeHttpRequestsShouldModifyImpTagId() {
193158 .banner (Banner .builder ().build ())
194159 .tagid ("some tag id" )
195160 .ext (mapper .valueToTree (ExtPrebid .of (null ,
196- ExtImpMobilefuse .of (1 , 2 , "ext" )))));
161+ ExtImpMobilefuse .of (1 )))));
197162
198163 // when
199164 final Result <List <HttpRequest <BidRequest >>> result = target .makeHttpRequests (bidRequest );
@@ -212,7 +177,7 @@ public void makeHttpRequestsShouldModifyImpWithAddingSkadnWhenSkadnIsPresent() {
212177 // given
213178 final ObjectNode skadn = mapper .createObjectNode ().put ("something" , "something" );
214179 final ObjectNode impExt = mapper .createObjectNode ();
215- impExt .set ("bidder" , mapper .valueToTree (ExtImpMobilefuse .of (1 , 2 , "ext" )));
180+ impExt .set ("bidder" , mapper .valueToTree (ExtImpMobilefuse .of (1 )));
216181 impExt .set ("skadn" , skadn );
217182 final BidRequest bidRequest = givenBidRequest (
218183 impBuilder -> impBuilder .banner (Banner .builder ().build ()).ext (impExt ));
0 commit comments