3131import org .prebid .server .proto .openrtb .ext .request .epsilon .ExtImpEpsilon ;
3232import org .prebid .server .proto .openrtb .ext .response .BidType ;
3333import org .prebid .server .proto .openrtb .ext .response .ExtBidResponse ;
34+ import org .prebid .server .util .VersionInfo ;
3435
3536import java .math .BigDecimal ;
3637import java .util .Collections ;
@@ -64,13 +65,14 @@ public class EpsilonBidderTest extends VertxTest {
6465
6566 @ BeforeEach
6667 public void setUp () {
67- target = new EpsilonBidder (ENDPOINT_URL , false , jacksonMapper , currencyConversionService );
68+ target = new EpsilonBidder (ENDPOINT_URL , false , null , jacksonMapper , currencyConversionService );
6869 }
6970
7071 @ Test
7172 public void creationShouldFailOnInvalidEndpointUrl () {
7273 assertThatIllegalArgumentException ()
73- .isThrownBy (() -> new EpsilonBidder ("invalid_url" , false , jacksonMapper , currencyConversionService ));
74+ .isThrownBy (() -> new EpsilonBidder (
75+ "invalid_url" , false , null , jacksonMapper , currencyConversionService ));
7476 }
7577
7678 @ Test
@@ -186,7 +188,7 @@ public void makeHttpRequestsShouldSetSiteIdFromExtSiteIdIfSiteIdIsNullOrEmpty()
186188 }
187189
188190 @ Test
189- public void makeHttpRequestsShouldSetImpDisplayManagerAndDisplayManagerVer () {
191+ public void makeHttpRequestsShouldSetImpDisplayManager () {
190192 // given
191193 final BidRequest bidRequest = givenBidRequest (identity ());
192194
@@ -198,8 +200,63 @@ public void makeHttpRequestsShouldSetImpDisplayManagerAndDisplayManagerVer() {
198200 assertThat (result .getValue ()).hasSize (1 )
199201 .extracting (httpRequest -> mapper .readValue (httpRequest .getBody (), BidRequest .class ))
200202 .flatExtracting (BidRequest ::getImp )
201- .extracting (Imp ::getDisplaymanager , Imp ::getDisplaymanagerver )
202- .containsExactly (tuple ("prebid-s2s" , "2.0.0" ));
203+ .extracting (Imp ::getDisplaymanager )
204+ .containsExactly ("prebid-s2s-java" );
205+ }
206+
207+ @ Test
208+ public void makeHttpRequestsShouldNotSetDisplayManagerVerWhenVersionIsNull () {
209+ // given
210+ target = new EpsilonBidder (ENDPOINT_URL , false , null , jacksonMapper , currencyConversionService );
211+ final BidRequest bidRequest = givenBidRequest (identity ());
212+
213+ // when
214+ final Result <List <HttpRequest <BidRequest >>> result = target .makeHttpRequests (bidRequest );
215+
216+ // then
217+ assertThat (result .getErrors ()).isEmpty ();
218+ assertThat (result .getValue ()).hasSize (1 )
219+ .extracting (httpRequest -> mapper .readValue (httpRequest .getBody (), BidRequest .class ))
220+ .flatExtracting (BidRequest ::getImp )
221+ .extracting (Imp ::getDisplaymanagerver )
222+ .containsOnlyNulls ();
223+ }
224+
225+ @ Test
226+ public void makeHttpRequestsShouldNotSetDisplayManagerVerWhenVersionIsUndefined () {
227+ // given
228+ target = new EpsilonBidder (
229+ ENDPOINT_URL , false , VersionInfo .UNDEFINED , jacksonMapper , currencyConversionService );
230+ final BidRequest bidRequest = givenBidRequest (identity ());
231+
232+ // when
233+ final Result <List <HttpRequest <BidRequest >>> result = target .makeHttpRequests (bidRequest );
234+
235+ // then
236+ assertThat (result .getErrors ()).isEmpty ();
237+ assertThat (result .getValue ()).hasSize (1 )
238+ .extracting (httpRequest -> mapper .readValue (httpRequest .getBody (), BidRequest .class ))
239+ .flatExtracting (BidRequest ::getImp )
240+ .extracting (Imp ::getDisplaymanagerver )
241+ .containsOnlyNulls ();
242+ }
243+
244+ @ Test
245+ public void makeHttpRequestsShouldSetDisplayManagerVerWhenVersionIsProvided () {
246+ // given
247+ target = new EpsilonBidder (ENDPOINT_URL , false , "1.2.3" , jacksonMapper , currencyConversionService );
248+ final BidRequest bidRequest = givenBidRequest (identity ());
249+
250+ // when
251+ final Result <List <HttpRequest <BidRequest >>> result = target .makeHttpRequests (bidRequest );
252+
253+ // then
254+ assertThat (result .getErrors ()).isEmpty ();
255+ assertThat (result .getValue ()).hasSize (1 )
256+ .extracting (httpRequest -> mapper .readValue (httpRequest .getBody (), BidRequest .class ))
257+ .flatExtracting (BidRequest ::getImp )
258+ .extracting (Imp ::getDisplaymanagerver )
259+ .containsExactly ("1.2.3" );
203260 }
204261
205262 @ Test
@@ -697,7 +754,7 @@ public void makeBidsShouldReturnAudioBidIfRequestImpHasAudio() throws JsonProces
697754 @ Test
698755 public void makeBidsShouldUpdateBidWithUUIDIfGenerateBidIdIsTrue () throws JsonProcessingException {
699756 // given
700- target = new EpsilonBidder (ENDPOINT_URL , true , jacksonMapper , currencyConversionService );
757+ target = new EpsilonBidder (ENDPOINT_URL , true , null , jacksonMapper , currencyConversionService );
701758 final BidderCall <BidRequest > httpCall = givenHttpCall (
702759 givenBidRequest (builder -> builder .id ("123" )
703760 .banner (Banner .builder ().build ())),
0 commit comments