From 32fbf7ca257aa0778aef3f84b8eb0b8635f1a728 Mon Sep 17 00:00:00 2001 From: Serhii Nahornyi Date: Mon, 22 Feb 2021 21:52:02 +0200 Subject: [PATCH] Create test for checking sending bids with same impId. --- .../bidder/rubicon/RubiconBidderTest.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/test/java/org/prebid/server/bidder/rubicon/RubiconBidderTest.java b/src/test/java/org/prebid/server/bidder/rubicon/RubiconBidderTest.java index d49e4cbbee6..42bc662a312 100644 --- a/src/test/java/org/prebid/server/bidder/rubicon/RubiconBidderTest.java +++ b/src/test/java/org/prebid/server/bidder/rubicon/RubiconBidderTest.java @@ -2306,6 +2306,45 @@ public void makeBidsShouldReturnVideoBidIfRequestImpHasVideo() throws JsonProces .containsOnly(BidderBid.of(Bid.builder().price(ONE).build(), video, "USD")); } + @Test + public void makeBidsShouldNotReduceBidderAmountForBidsWithSameImpId() throws JsonProcessingException { + // given + final Bid firstBid = Bid.builder() + .id("firstBidId") + .impid("impId") + .price(ONE) + .build(); + + final Bid secondBid = Bid.builder() + .id("secondBidId") + .impid("impId") + .price(ONE) + .build(); + + final String bidResponse = mapper.writeValueAsString(BidResponse.builder() + .cur("USD") + .seatbid(singletonList(SeatBid.builder() + .bid(Arrays.asList(firstBid, secondBid)) + .build())) + .build()); + + final HttpCall httpCall = givenHttpCall( + givenBidRequest(builder -> builder.video(Video.builder().build())), + bidResponse); + final BidRequest bidRequest = givenBidRequest( + impBuilder -> impBuilder.id("impId").video(Video.builder().build())); + + // when + final Result> result = rubiconBidder.makeBids(httpCall, bidRequest); + + // then + assertThat(result.getErrors()).isEmpty(); + assertThat(result.getValue()) + .extracting(BidderBid::getBid) + .extracting(Bid::getId) + .containsExactlyInAnyOrder("firstBidId", "secondBidId"); + } + @Test public void makeBidsShouldNotReturnImpIfNonDealBidPriceLessThanZero() throws JsonProcessingException { // given