@@ -91,10 +91,46 @@ public void makeHttpRequestsShouldAddPlacementIdOnlyInFirstImpressionTagId() {
9191 assertThat (result .getValue ())
9292 .extracting (httpRequest -> mapper .readValue (httpRequest .getBody (), BidRequest .class ))
9393 .flatExtracting (BidRequest ::getImp )
94- .extracting (imp -> imp . getTagid () )
94+ .extracting (Imp :: getTagid )
9595 .containsExactly ("pid" , null );
9696 }
9797
98+ @ Test
99+ public void makeHttpRequestsShouldOverrideTagIdWithPlacementId () {
100+ // given
101+ final ObjectNode mobkoiExt = impExt ("pid" );
102+ final Imp givenImp = givenImp (impBuilder -> impBuilder .tagid ("tagId" ).ext (mobkoiExt ));
103+ final BidRequest bidRequest = BidRequest .builder ().imp (asList (givenImp )).build ();
104+
105+ // when
106+ final Result <List <HttpRequest <BidRequest >>> result = target .makeHttpRequests (bidRequest );
107+
108+ // then
109+ assertThat (result .getValue ())
110+ .extracting (httpRequest -> mapper .readValue (httpRequest .getBody (), BidRequest .class ))
111+ .flatExtracting (BidRequest ::getImp )
112+ .extracting (Imp ::getTagid )
113+ .containsExactly ("pid" );
114+ }
115+
116+ @ Test
117+ public void makeHttpRequestsShouldKeepOriginalTagIdWhenPlacementIdMissing () {
118+ // given
119+ final ObjectNode mobkoiExt = impExt (null );
120+ final Imp givenImp = givenImp (impBuilder -> impBuilder .tagid ("tagId" ).ext (mobkoiExt ));
121+ final BidRequest bidRequest = BidRequest .builder ().imp (asList (givenImp )).build ();
122+
123+ // when
124+ final Result <List <HttpRequest <BidRequest >>> result = target .makeHttpRequests (bidRequest );
125+
126+ // then
127+ assertThat (result .getValue ())
128+ .extracting (httpRequest -> mapper .readValue (httpRequest .getBody (), BidRequest .class ))
129+ .flatExtracting (BidRequest ::getImp )
130+ .extracting (Imp ::getTagid )
131+ .containsExactly ("tagId" );
132+ }
133+
98134 @ Test
99135 public void makeHttpRequestsShouldOverrideUserExtAndSetConsent () {
100136 // given
0 commit comments