Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
przemkaczmarek committed Jan 8, 2025
1 parent 826a103 commit c6fe5f2
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,27 @@ public void makeBidsShouldReturnNativeBidIfMTypeIsNative() throws JsonProcessing
.containsOnly(BidderBid.of(Bid.builder().impid("123").mtype(4).build(), xNative, "USD"));
}

@Test
public void makeBidsShouldThrowErrorWhenMediaTypeIsMissing() throws JsonProcessingException {
// given
final BidderCall<BidRequest> httpCall = givenHttpCall(BidRequest.builder()
.imp(singletonList(Imp.builder().id("123").build()))
.build(),
mapper.writeValueAsString(
givenBidResponse(bidBuilder -> bidBuilder.impid("123"))));

// when
final Result<List<BidderBid>> result = target.makeBids(httpCall, null);

// then
assertThat(result.getValue()).isEmpty();
assertThat(result.getErrors()).hasSize(1)
.allSatisfy(error -> {
assertThat(error.getMessage()).startsWith("Missing MType for bid: null");
assertThat(error.getType()).isEqualTo(BidderError.Type.bad_server_response);
});
}

private static BidRequest givenBidRequest(
UnaryOperator<BidRequest.BidRequestBuilder> bidRequestCustomizer,
UnaryOperator<Imp.ImpBuilder> impCustomizer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"silvermob": {
"zoneid": "testZoneId",
"host": "eu"
}
},
"mtype": 1
},
"tagid": "tag_id"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
"prebid": {
"type": "banner"
},
"origbidcpm": 0.01
}
"origbidcpm": 0.01,
"origbidcur": "USD"
},
"mtype": 1
}
],
"seat": "silvermob",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"bidder": {
"zoneid": "testZoneId",
"host": "eu"
}
},
"mtype": 1
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
"price": 0.01,
"id": "bid_id",
"impid": "imp_id",
"cid": "cid"
"cid": "cid",
"mtype": 1
}
],
"type": "banner"
"seat": "silvermob"
}
]
],
"cur": "USD"
}

0 comments on commit c6fe5f2

Please sign in to comment.