Skip to content

Commit

Permalink
Create test for checking sending bids with same impId. (#1161)
Browse files Browse the repository at this point in the history
  • Loading branch information
SerhiiNahornyi authored and nickluck8 committed Aug 10, 2021
1 parent 5c77d69 commit adf4756
Showing 1 changed file with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2370,6 +2370,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<BidRequest> 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<List<BidderBid>> 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
Expand Down

0 comments on commit adf4756

Please sign in to comment.