Skip to content

Commit c6ec875

Browse files
authored
Compare currencies ignoring case (#3932)
1 parent 2ebf421 commit c6ec875

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

src/main/java/org/prebid/server/util/BidderUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public static boolean isValidPrice(Price price) {
6363

6464
public static boolean shouldConvertBidFloor(Price price, String bidderCurrency) {
6565
return isValidPrice(price)
66-
&& !StringUtils.equals(price.getCurrency(), bidderCurrency);
66+
&& !StringUtils.equalsIgnoreCase(price.getCurrency(), bidderCurrency);
6767
}
6868

6969
public static PriceFloorInfo resolvePriceFloor(Bid bid, BidRequest bidRequest) {

src/test/java/org/prebid/server/adtgorg/AdtgorgTest.java renamed to src/test/java/org/prebid/server/it/AdtgorgTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
package org.prebid.server.adtgorg;
1+
package org.prebid.server.it;
22

33
import io.restassured.response.Response;
44
import org.json.JSONException;
55
import org.junit.jupiter.api.Test;
6-
import org.prebid.server.it.IntegrationTest;
76
import org.prebid.server.model.Endpoint;
87

98
import java.io.IOException;

src/test/java/org/prebid/server/util/BidderUtilTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.iab.openrtb.request.Video;
99
import com.iab.openrtb.response.Bid;
1010
import org.junit.jupiter.api.Test;
11+
import org.prebid.server.bidder.model.Price;
1112
import org.prebid.server.bidder.model.PriceFloorInfo;
1213
import org.prebid.server.proto.openrtb.ext.response.BidType;
1314

@@ -48,6 +49,18 @@ public void isValidPriceShouldReturnTrueIfPriceIsGreaterThenZero() {
4849
assertThat(BidderUtil.isValidPrice(BigDecimal.ONE)).isTrue();
4950
}
5051

52+
@Test
53+
public void shouldConvertBidFloorShouldReturnTrueIfCurrenciesAreDifferent() {
54+
// when and then
55+
assertThat(BidderUtil.shouldConvertBidFloor(Price.of("USD", BigDecimal.ONE), "EUR")).isTrue();
56+
}
57+
58+
@Test
59+
public void shouldConvertBidFloorShouldReturnFalseIfCurrenciesAreSameIgnoringCase() {
60+
// when and then
61+
assertThat(BidderUtil.shouldConvertBidFloor(Price.of("uSd", BigDecimal.ONE), "UsD")).isFalse();
62+
}
63+
5164
@Test
5265
public void resolvePriceFloorShouldReturnNullIfBidIsMissing() {
5366
// when

0 commit comments

Comments
 (0)