public static BidResponse newBidResponse(BidOrBuilder... bids) { SeatBid.Builder seat = SeatBid.newBuilder(); for (BidOrBuilder bid : bids) { if (bid instanceof Bid) { seat.addBid((Bid) bid); } else { seat.addBid((Bid.Builder) bid); } } return BidResponse.newBuilder().addSeatbid(seat).build(); }
@Test public void testResponse() { NetworkBid.BidResponse.Builder dcResponse = mapper.toExchangeBidResponse( TestUtil.newBidRequest("1", 1, 1, 1.0).build(), BidResponse.newBuilder() .setId("1") .setBidid("bidid") .addSeatbid(SeatBid.newBuilder().addBid(TestData.newBid(false))) .build()); assertThat(dcResponse).isNotNull(); assertThat(dcResponse.getDebugString()).isEqualTo("bidid"); assertThat(dcResponse.getAdCount()).isEqualTo(1); NetworkBid.BidResponse.Ad ad = dcResponse.getAd(0); assertThat(ad.getAdslotCount()).isEqualTo(1); assertThat(ad.getAdslot(0).getId()).isEqualTo(1); assertThat(ad.getAdslot(0).hasBillingId()).isFalse(); assertThat(ad.getAdslot(0).getMaxCpmMicros()).isEqualTo(1200000); }