Skip to content

Commit

Permalink
Fix video info propagation.
Browse files Browse the repository at this point in the history
  • Loading branch information
CTMBNara committed Jul 11, 2024
1 parent 24ff2b7 commit 0378dc9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -182,6 +183,10 @@ private ExtBidPrebid parseBidExt(ObjectNode bidExt) {
}

private ExtBidPrebidVideo videoInfo(ExtBidPrebid extBidPrebid) {
return extBidPrebid != null ? extBidPrebid.getVideo() : null;
return Optional.ofNullable(extBidPrebid)
.map(ExtBidPrebid::getVideo)
.map(ExtBidPrebidVideo::getDuration)
.map(duration -> ExtBidPrebidVideo.of(duration, null))
.orElse(null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ public void makeBidsShouldReturnVideoInfo() throws JsonProcessingException {
mapper.writeValueAsString(
givenBidResponse(bidBuilder -> bidBuilder
.impid("123")
.ext(mapper.valueToTree(Map.of("video", Map.of("duration", 1)))))));
.ext(mapper.valueToTree(Map.of("video", Map.of(
"duration", 1,
"primary_category", "cat")))))));

// when
final Result<List<BidderBid>> result = target.makeBids(httpCall, null);
Expand All @@ -275,7 +277,9 @@ public void makeBidsShouldReturnVideoInfo() throws JsonProcessingException {
.containsExactly(BidderBid.builder()
.bid(Bid.builder()
.impid("123")
.ext(mapper.valueToTree(Map.of("video", Map.of("duration", 1))))
.ext(mapper.valueToTree(Map.of("video", Map.of(
"duration", 1,
"primary_category", "cat"))))
.build())
.type(xNative)
.bidCurrency("EUR")
Expand Down

0 comments on commit 0378dc9

Please sign in to comment.