@@ -152,7 +152,9 @@ public void makeHttpRequestsShouldReturnErrorIfImpExtCouldNotBeParsed() {
152152 @ Test
153153 public void makeBidsShouldReturnExpectedBannerBid () throws JsonProcessingException {
154154 // given
155- final ObjectNode dsaResponse = createDsaResponse ();
155+ final ObjectNode bidExt = mapper .createObjectNode ();
156+ bidExt .put ("something" , "else" );
157+ bidExt .set ("dsa" , createDsaResponse ());
156158
157159 final StroeerCoreBid bannerBid = StroeerCoreBid .builder ()
158160 .id ("1" )
@@ -163,7 +165,7 @@ public void makeBidsShouldReturnExpectedBannerBid() throws JsonProcessingExcepti
163165 .width (300 )
164166 .height (600 )
165167 .mtype ("banner" )
166- .dsa ( dsaResponse .deepCopy ())
168+ .ext ( bidExt .deepCopy ())
167169 .adomain (List .of ("domain1.com" , "domain2.com" ))
168170 .build ();
169171
@@ -184,13 +186,71 @@ public void makeBidsShouldReturnExpectedBannerBid() throws JsonProcessingExcepti
184186 .h (600 )
185187 .adomain (List .of ("domain1.com" , "domain2.com" ))
186188 .mtype (1 )
187- .ext (mapper . createObjectNode (). set ( "dsa" , dsaResponse ) )
189+ .ext (bidExt )
188190 .build ();
189191
190192 assertThat (result .getErrors ()).isEmpty ();
191193 assertThat (result .getValue ()).containsOnly (BidderBid .of (expectedBannerBid , BidType .banner , "EUR" ));
192194 }
193195
196+ @ Test
197+ public void makeBidsShouldSupportDeprecatedDsaPath () throws JsonProcessingException {
198+ // given
199+ final ObjectNode dsa = createDsaResponse ();
200+
201+ final StroeerCoreBid .StroeerCoreBidBuilder stroeerBidBuilder = StroeerCoreBid .builder ()
202+ .id ("1" )
203+ .bidId ("banner-imp-id" )
204+ .adMarkup ("<div></div>" )
205+ .cpm (BigDecimal .valueOf (0.3 ))
206+ .creativeId ("foo" )
207+ .width (300 )
208+ .height (600 )
209+ .mtype ("banner" )
210+ .adomain (List .of ("domain1.com" , "domain2.com" ))
211+ .dsa (dsa .deepCopy ());
212+
213+ final StroeerCoreBid bannerBidWithoutExt = stroeerBidBuilder
214+ .ext (null )
215+ .build ();
216+
217+ final StroeerCoreBid bannerBidWithExt = stroeerBidBuilder
218+ .ext (mapper .createObjectNode ().put ("xyz" , true ))
219+ .build ();
220+
221+ final StroeerCoreBidResponse response = StroeerCoreBidResponse .of (
222+ List .of (bannerBidWithoutExt , bannerBidWithExt ));
223+ final BidderCall <BidRequest > httpCall = createHttpCall (response );
224+
225+ // when
226+ final Result <List <BidderBid >> result = target .makeBids (httpCall , null );
227+
228+ // then
229+ final Bid .BidBuilder expectedBannerBidBuilder = Bid .builder ()
230+ .id ("1" )
231+ .impid ("banner-imp-id" )
232+ .adm ("<div></div>" )
233+ .price (BigDecimal .valueOf (0.3 ))
234+ .crid ("foo" )
235+ .w (300 )
236+ .h (600 )
237+ .adomain (List .of ("domain1.com" , "domain2.com" ))
238+ .mtype (1 );
239+
240+ final Bid expectedBid1 = expectedBannerBidBuilder
241+ .ext (mapper .createObjectNode ().set ("dsa" , dsa ))
242+ .build ();
243+
244+ final Bid expectedBid2 = expectedBannerBidBuilder
245+ .ext (mapper .createObjectNode ().put ("xyz" , true ).set ("dsa" , dsa ))
246+ .build ();
247+
248+ assertThat (result .getErrors ()).isEmpty ();
249+ assertThat (result .getValue ()).containsOnly (
250+ BidderBid .of (expectedBid1 , BidType .banner , "EUR" ),
251+ BidderBid .of (expectedBid2 , BidType .banner , "EUR" ));
252+ }
253+
194254 @ Test
195255 public void makeBidsShouldReturnExpectedBidderBids () throws JsonProcessingException {
196256 // given
0 commit comments