Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insticator: fix video validation logic #3724

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private void validateImp(Imp imp) {

if (isInvalidDimension(video.getH())
|| isInvalidDimension(video.getW())
|| CollectionUtils.isNotEmpty(video.getMimes())) {
|| CollectionUtils.isEmpty(video.getMimes())) {

throw new PreBidException("One or more invalid or missing video field(s) w, h, mimes");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,11 +449,11 @@ public void makeHttpRequestsShouldMakeOneRequestWhenOneImpIsValidAndAnotherAreIn
final BidRequest bidRequest = givenBidRequest(
imp -> imp.id("givenImpId1").ext(mapper.valueToTree(ExtPrebid.of(null, mapper.createArrayNode()))),
imp -> imp.id("givenImpId2"),
imp -> imp.id("givenImpId3").video(Video.builder().mimes(null).build()),
imp -> imp.id("givenImpId4").video(Video.builder().h(null).build()),
imp -> imp.id("givenImpId5").video(Video.builder().h(0).build()),
imp -> imp.id("givenImpId6").video(Video.builder().w(null).build()),
imp -> imp.id("givenImpId7").video(Video.builder().w(0).build()));
imp -> imp.id("givenImpId3").video(givenVideo(video -> video.mimes(null))),
imp -> imp.id("givenImpId4").video(givenVideo(video -> video.h(null))),
imp -> imp.id("givenImpId5").video(givenVideo(video -> video.h(0))),
imp -> imp.id("givenImpId6").video(givenVideo(video -> video.w(null))),
imp -> imp.id("givenImpId7").video(givenVideo(video -> video.w(0))));

//when
final Result<List<HttpRequest<BidRequest>>> result = target.makeHttpRequests(bidRequest);
Expand Down Expand Up @@ -569,6 +569,14 @@ private static Imp givenImp(UnaryOperator<Imp.ImpBuilder> impCustomizer) {
.build();
}

private static Video givenVideo(UnaryOperator<Video.VideoBuilder> videoCustomizer) {
return videoCustomizer.apply(Video.builder()
.mimes(List.of("video/mp4"))
.h(100)
.w(100))
.build();
}

private static ObjectNode givenImpExt(String adUnitId) {
return givenImpExt(adUnitId, "publisherId");
}
Expand Down
Loading