Skip to content

Commit d85bf2f

Browse files
committed
fix test and refactor
1 parent 8b335a7 commit d85bf2f

2 files changed

Lines changed: 1 addition & 16 deletions

File tree

src/main/java/org/prebid/server/bidder/openx/OpenxBidder.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ public class OpenxBidder implements Bidder<BidRequest> {
6262
private static final TypeReference<ExtPrebid<ExtImpPrebid, ExtImpOpenx>> OPENX_EXT_TYPE_REFERENCE =
6363
new TypeReference<>() {
6464
};
65-
private static final TypeReference<ExtPrebid<ExtBidPrebid, ObjectNode>> EXT_PREBID_TYPE_REFERENCE =
66-
new TypeReference<>() {
67-
};
6865

6966
private final String endpointUrl;
7067
private final JacksonMapper mapper;
@@ -357,16 +354,13 @@ private ObjectNode updateBidMeta(Bid bid) {
357354
return ext;
358355
}
359356

360-
final var extPrebid = getExtPrebid(ext, bid.getId());
361357
final var updatedMeta = ExtBidPrebidMeta.builder()
362358
.networkId(dspId)
363359
.advertiserId(buyerId)
364360
.brandId(brandId)
365361
.build();
366362

367-
final var modifiedExtBidPrebid = Optional.ofNullable(extPrebid.getPrebid())
368-
.map(p -> p.toBuilder().meta(updatedMeta).build())
369-
.orElse(ExtBidPrebid.builder().meta(updatedMeta).build());
363+
final var modifiedExtBidPrebid = ExtBidPrebid.builder().meta(updatedMeta).build();
370364

371365
final var updatedExt = ext.deepCopy();
372366
updatedExt.set(PREBID_EXT, mapper.mapper().valueToTree(modifiedExtBidPrebid));
@@ -382,14 +376,6 @@ private OpenxBidExt parseOpenxBidExt(ObjectNode ext) {
382376
}
383377
}
384378

385-
private ExtPrebid<ExtBidPrebid, ObjectNode> getExtPrebid(ObjectNode bidExt, String bidId) {
386-
try {
387-
return mapper.mapper().convertValue(bidExt, EXT_PREBID_TYPE_REFERENCE);
388-
} catch (IllegalArgumentException e) {
389-
throw new PreBidException("Invalid ext in bid with id: " + bidId, e);
390-
}
391-
}
392-
393379
private int parseStringToInt(String value) {
394380
try {
395381
return value != null ? Integer.parseInt(value) : 0;

src/test/java/org/prebid/server/bidder/openx/OpenxBidderTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,6 @@ public void makeBidsShouldReturnBidMeta() throws JsonProcessingException {
10021002
allBuyerExt.put("dsp_id", "1").put("buyer_id", "2").put("brand_id", "3");
10031003
onlyBrandExt.put("brand_id", "4");
10041004
badExt.put("dsp_id", "abc").put("brand_id", "cba");
1005-
badExt.put("something", "abc");
10061005

10071006
final var allBuyerExpectedExtJson = "{\"dsp_id\":\"1\",\"buyer_id\":\"2\",\"brand_id\":\"3\",\"prebid\":"
10081007
+ "{\"meta\":{\"advertiserId\":2,\"brandId\":3,\"networkId\":1}}}";

0 commit comments

Comments
 (0)