Skip to content

Commit

Permalink
extend makeHttpRequestsShouldReturnResultWithExpectedFieldsSet() with…
Browse files Browse the repository at this point in the history
… native imps
  • Loading branch information
sergseven committed Dec 23, 2024
1 parent 55cbecf commit b8355a2
Showing 1 changed file with 52 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.iab.openrtb.request.Banner;
import com.iab.openrtb.request.BidRequest;
import com.iab.openrtb.request.Imp;
import com.iab.openrtb.request.Native;
import com.iab.openrtb.request.Regs;
import com.iab.openrtb.request.User;
import com.iab.openrtb.request.Video;
Expand Down Expand Up @@ -221,6 +222,24 @@ public void makeHttpRequestsShouldReturnResultWithExpectedFieldsSet() {
.customParams(givenCustomParams("foo4", "bar4"))
.platform("PLATFORM")
.unit("555555").build()))).build(),
Imp.builder()
.id("impId5")
.xNative(Native.builder().build())
.ext(mapper.valueToTree(
ExtPrebid.of(null,
ExtImpOpenx.builder()
.customParams(givenCustomParams("foo5", "bar5"))
.delDomain("se-demo-d.openx.net")
.unit("5").build()))).build(),
Imp.builder()
.id("impId6")
.xNative(Native.builder().build())
.ext(mapper.valueToTree(
ExtPrebid.of(null,
ExtImpOpenx.builder()
.customParams(givenCustomParams("foo6", "bar6"))
.delDomain("se-demo-d.openx.net")
.unit("6").build()))).build(),

Imp.builder().id("impId1").audio(Audio.builder().build()).build()))
.user(User.builder().ext(ExtUser.builder().consent("consent").build()).build())
Expand All @@ -235,7 +254,7 @@ public void makeHttpRequestsShouldReturnResultWithExpectedFieldsSet() {
.containsExactly(BidderError.badInput(
"OpenX only supports banner, video and native imps. Ignoring imp id=impId1"));

assertThat(result.getValue()).hasSize(3)
assertThat(result.getValue()).hasSize(4)
.extracting(httpRequest -> mapper.readValue(httpRequest.getBody(), BidRequest.class))
.containsExactly(
// check if all banner imps are part of single bidRequest
Expand Down Expand Up @@ -320,6 +339,38 @@ public void makeHttpRequestsShouldReturnResultWithExpectedFieldsSet() {
.ext(ExtUser.builder().consent("consent").build())
.build())
.regs(Regs.builder().coppa(0).ext(ExtRegs.of(1, null, null, null)).build())
.build(),
// check if all native imps are part of single bidRequest
BidRequest.builder()
.id("bidRequestId")
.imp(asList(
Imp.builder()
.id("impId5")
.tagid("5")
.xNative(Native.builder().build())
.ext(mapper.valueToTree(
ExtImpOpenx.builder()
.customParams(
givenCustomParams("foo5", "bar5"))
.build()))
.build(),
Imp.builder()
.id("impId6")
.tagid("6")
.xNative(Native.builder().build())
.ext(mapper.valueToTree(
ExtImpOpenx.builder()
.customParams(
givenCustomParams("foo6", "bar6"))
.build()))
.build()))
.ext(jacksonMapper.fillExtension(
ExtRequest.empty(),
OpenxRequestExt.of("se-demo-d.openx.net", null, "hb_pbs_1.0.0")))
.user(User.builder()
.ext(ExtUser.builder().consent("consent").build())
.build())
.regs(Regs.builder().coppa(0).ext(ExtRegs.of(1, null, null, null)).build())
.build());
}

Expand Down

0 comments on commit b8355a2

Please sign in to comment.