From 0e47f1b3ea129e7664eabff3a5dda0d20b476680 Mon Sep 17 00:00:00 2001 From: Yevhenii Viktorov <91950229+yevhenii-viktorov@users.noreply.github.com> Date: Fri, 21 Jan 2022 12:58:26 +0200 Subject: [PATCH] Remove FacebookNative (#1691) --- .../java/com/iab/openrtb/request/Native.java | 6 ++---- .../server/bidder/facebook/FacebookBidder.java | 5 +---- .../bidder/facebook/proto/FacebookNative.java | 16 ---------------- .../prebid/server/bidder/adf/AdfBidderTest.java | 2 +- .../bidder/facebook/FacebookBidderTest.java | 7 ++----- .../server/validation/RequestValidatorTest.java | 2 +- 6 files changed, 7 insertions(+), 31 deletions(-) delete mode 100644 src/main/java/org/prebid/server/bidder/facebook/proto/FacebookNative.java diff --git a/src/main/java/com/iab/openrtb/request/Native.java b/src/main/java/com/iab/openrtb/request/Native.java index f152b0b169d..49d4264eb6f 100644 --- a/src/main/java/com/iab/openrtb/request/Native.java +++ b/src/main/java/com/iab/openrtb/request/Native.java @@ -1,9 +1,8 @@ package com.iab.openrtb.request; import com.fasterxml.jackson.databind.node.ObjectNode; +import lombok.Builder; import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; import java.util.List; @@ -27,8 +26,7 @@ * the offered types. */ @Data -@SuperBuilder(toBuilder = true) -@NoArgsConstructor +@Builder(toBuilder = true) public class Native { /** diff --git a/src/main/java/org/prebid/server/bidder/facebook/FacebookBidder.java b/src/main/java/org/prebid/server/bidder/facebook/FacebookBidder.java index 2641dd971cd..8f160c962ec 100644 --- a/src/main/java/org/prebid/server/bidder/facebook/FacebookBidder.java +++ b/src/main/java/org/prebid/server/bidder/facebook/FacebookBidder.java @@ -22,7 +22,6 @@ import org.prebid.server.bidder.Bidder; import org.prebid.server.bidder.facebook.proto.FacebookAdMarkup; import org.prebid.server.bidder.facebook.proto.FacebookExt; -import org.prebid.server.bidder.facebook.proto.FacebookNative; import org.prebid.server.bidder.model.BidderBid; import org.prebid.server.bidder.model.BidderError; import org.prebid.server.bidder.model.HttpCall; @@ -246,9 +245,7 @@ private static boolean isBannerHeightValid(Integer h) { * Add Width and Height (not available in standard openRTB) and exclude native.request and native.ver fields */ private static Native modifyNative(Native xNative) { - return FacebookNative.builder() - .w(-1) - .h(-1) + return Native.builder() .api(xNative.getApi()) .battr(xNative.getBattr()) .ext(xNative.getExt()) diff --git a/src/main/java/org/prebid/server/bidder/facebook/proto/FacebookNative.java b/src/main/java/org/prebid/server/bidder/facebook/proto/FacebookNative.java deleted file mode 100644 index f2da9b4cd1d..00000000000 --- a/src/main/java/org/prebid/server/bidder/facebook/proto/FacebookNative.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.prebid.server.bidder.facebook.proto; - -import com.iab.openrtb.request.Native; -import lombok.EqualsAndHashCode; -import lombok.Value; -import lombok.experimental.SuperBuilder; - -@Value -@SuperBuilder -@EqualsAndHashCode(callSuper = true) -public class FacebookNative extends Native { - - Integer w; - - Integer h; -} diff --git a/src/test/java/org/prebid/server/bidder/adf/AdfBidderTest.java b/src/test/java/org/prebid/server/bidder/adf/AdfBidderTest.java index 140b6a5aaa8..69fbe3662e7 100644 --- a/src/test/java/org/prebid/server/bidder/adf/AdfBidderTest.java +++ b/src/test/java/org/prebid/server/bidder/adf/AdfBidderTest.java @@ -185,7 +185,7 @@ public void makeBidsShouldReturnNativeBid() throws JsonProcessingException { // given final HttpCall httpCall = givenHttpCall( BidRequest.builder().imp(singletonList(Imp.builder().id("123") - .xNative(new Native()) + .xNative(Native.builder().build()) .build())).build(), mapper.writeValueAsString(givenBidResponse( bidBuilder -> bidBuilder.impid("123").ext(createBidExtPrebidWithType("native"))))); diff --git a/src/test/java/org/prebid/server/bidder/facebook/FacebookBidderTest.java b/src/test/java/org/prebid/server/bidder/facebook/FacebookBidderTest.java index fd429b94549..58cbfee4b70 100644 --- a/src/test/java/org/prebid/server/bidder/facebook/FacebookBidderTest.java +++ b/src/test/java/org/prebid/server/bidder/facebook/FacebookBidderTest.java @@ -20,7 +20,6 @@ import org.junit.Test; import org.prebid.server.VertxTest; import org.prebid.server.bidder.facebook.proto.FacebookExt; -import org.prebid.server.bidder.facebook.proto.FacebookNative; import org.prebid.server.bidder.model.BidderBid; import org.prebid.server.bidder.model.BidderError; import org.prebid.server.bidder.model.HttpCall; @@ -423,18 +422,16 @@ public void makeHttpRequestsShouldModifyImpNativeByAddingWidthAndHeightAndRemovi // then assertThat(result.getErrors()).isEmpty(); assertThat(result.getValue()).hasSize(1) - // use payload as deserializing from body json string converts native to parent class, which - // is not aware of child's fields .extracting(HttpRequest::getPayload) .flatExtracting(BidRequest::getImp) .extracting(Imp::getXNative) - .containsOnly(FacebookNative.builder().w(-1).h(-1).api(singletonList(1)).build()); + .containsOnly(Native.builder().api(singletonList(1)).build()); // extra check to assure that data in body is displayed correctly assertThat(result.getValue()) .extracting(value -> new String(value.getBody())) .allSatisfy(s -> assertThat(s) - .contains("\"native\":{\"api\":[1],\"w\":-1,\"h\":-1},\"tagid\":\"pubId_placementId\"}")); + .contains("\"native\":{\"api\":[1]},\"tagid\":\"pubId_placementId\"}")); } @Test diff --git a/src/test/java/org/prebid/server/validation/RequestValidatorTest.java b/src/test/java/org/prebid/server/validation/RequestValidatorTest.java index 301f923ceb8..463268a30e4 100644 --- a/src/test/java/org/prebid/server/validation/RequestValidatorTest.java +++ b/src/test/java/org/prebid/server/validation/RequestValidatorTest.java @@ -3084,7 +3084,7 @@ public void validateShouldReturnValidationMessageWhenRequestHaveDuplicatedImpIds } private static BidRequest givenBidRequest( - UnaryOperator> nativeCustomizer) { + UnaryOperator nativeCustomizer) { return validBidRequestBuilder() .imp(singletonList(validImpBuilder() .xNative(nativeCustomizer.apply(Native.builder()).build()).build())).build();