@@ -144,7 +144,7 @@ public void makeHttpRequestsShouldCreateARequestForEachImpAndSkipImpsWithNoBanne
144144 final Result <List <HttpRequest <BidRequest >>> result = target .makeHttpRequests (bidRequest );
145145 // then
146146 assertThat (result .getErrors ()).containsExactly (
147- BidderError .badInput ("Yandex only supports banner and native types. Ignoring imp id #blockA" )
147+ BidderError .badInput ("Yandex only supports banner, video, and native types. Ignoring imp id #blockA" )
148148 );
149149 }
150150
@@ -215,6 +215,57 @@ public void makeHttpRequestsSetFirstImpressionBannerWidthAndHeightWhenFromFirstF
215215 .containsOnly (tuple (300 , 600 ));
216216 }
217217
218+ @ Test
219+ public void makeHttpRequestsShouldReturnErrorWhenVideoWidthIsZero () {
220+ // given
221+ final BidRequest bidRequest = givenBidRequest (
222+ impBuilder -> impBuilder .id ("blockA" ).banner (null ).video (Video .builder ().w (0 ).h (600 ).build ()),
223+ identity ());
224+
225+ // when
226+ final Result <List <HttpRequest <BidRequest >>> result = target .makeHttpRequests (bidRequest );
227+
228+ // then
229+ assertThat (result .getValue ()).isEmpty ();
230+ assertThat (result .getErrors ()).containsExactly (BidderError .badInput ("Invalid sizes provided for Video 0x600" ));
231+ }
232+
233+ @ Test
234+ public void makeHttpRequestsShouldReturnErrorWhenVideoHeightIsZero () {
235+ // given
236+ final BidRequest bidRequest = givenBidRequest (
237+ impBuilder -> impBuilder .id ("blockA" ).banner (null ).video (Video .builder ().w (300 ).h (0 ).build ()),
238+ identity ());
239+
240+ // when
241+ final Result <List <HttpRequest <BidRequest >>> result = target .makeHttpRequests (bidRequest );
242+
243+ // then
244+ assertThat (result .getValue ()).isEmpty ();
245+ assertThat (result .getErrors ()).containsExactly (BidderError .badInput ("Invalid sizes provided for Video 300x0" ));
246+ }
247+
248+ @ Test
249+ public void makeHttpRequestsShouldModifyVideoParameters () {
250+ // given
251+ final BidRequest bidRequest = givenBidRequest (
252+ impBuilder -> impBuilder .id ("blockA" ).banner (null )
253+ .video (Video .builder ().w (300 ).h (600 ).build ()),
254+ identity ());
255+
256+ // when
257+ final Result <List <HttpRequest <BidRequest >>> result = target .makeHttpRequests (bidRequest );
258+
259+ // then
260+ assertThat (result .getErrors ()).isEmpty ();
261+ assertThat (result .getValue ()).hasSize (1 )
262+ .extracting (HttpRequest ::getPayload )
263+ .flatExtracting (BidRequest ::getImp )
264+ .extracting (Imp ::getVideo )
265+ .extracting (Video ::getMinduration , Video ::getMaxduration , Video ::getMimes , Video ::getProtocols )
266+ .containsOnly (tuple (1 , 120 , singletonList ("video/mp4" ), singletonList (3 )));
267+ }
268+
218269 @ Test
219270 public void makeBidsShouldReturnErrorIfResponseBodyCouldNotBeParsed () {
220271 // given
@@ -444,4 +495,39 @@ private static BidderCall<BidRequest> givenBidderCall(BidRequest bidRequest, Str
444495 HttpResponse .of (200 , null , body ),
445496 null );
446497 }
498+
499+ @ Test
500+ public void makeHttpRequestsShouldSetDisplayManagerAndVersionForAllImpTypes () {
501+ // given
502+ final BidRequest bidRequest = BidRequest .builder ()
503+ .site (Site .builder ().id ("1" ).build ())
504+ .imp (asList (
505+ Imp .builder ().id ("bannerImp" )
506+ .banner (Banner .builder ().w (300 ).h (600 ).build ())
507+ .ext (givenImpExt (1 ))
508+ .build (),
509+ Imp .builder ().id ("videoImp" )
510+ .video (Video .builder ().w (300 ).h (600 ).build ())
511+ .ext (givenImpExt (2 ))
512+ .build (),
513+ Imp .builder ().id ("nativeImp" )
514+ .xNative (Native .builder ().build ())
515+ .ext (givenImpExt (3 ))
516+ .build ()))
517+ .build ();
518+
519+ // when
520+ final Result <List <HttpRequest <BidRequest >>> result = target .makeHttpRequests (bidRequest );
521+
522+ // then
523+ assertThat (result .getErrors ()).isEmpty ();
524+ assertThat (result .getValue ()).hasSize (3 )
525+ .extracting (HttpRequest ::getPayload )
526+ .flatExtracting (BidRequest ::getImp )
527+ .extracting (Imp ::getDisplaymanager , Imp ::getDisplaymanagerver )
528+ .containsOnly (
529+ tuple ("prebid.java" , "1.1" ),
530+ tuple ("prebid.java" , "1.1" ),
531+ tuple ("prebid.java" , "1.1" ));
532+ }
447533}
0 commit comments