use of org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.pmps.Format in project prebid-mobile-android by prebid.
the class Banner method getJsonObject.
public JSONObject getJsonObject() throws JSONException {
JSONObject jsonObject = new JSONObject();
toJSON(jsonObject, "pos", this.pos);
if (api != null) {
JSONArray jsonArray = new JSONArray();
for (int apiItem : api) {
jsonArray.put(apiItem);
}
toJSON(jsonObject, "api", jsonArray);
}
if (mFormats.size() > 0) {
JSONArray formatsArray = new JSONArray();
for (Format format : mFormats) {
formatsArray.put(format.getJsonObject());
}
toJSON(jsonObject, "format", formatsArray);
}
return jsonObject;
}
use of org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.pmps.Format in project prebid-mobile-android by prebid.
the class BasicParameterBuilderTest method whenAppendParametersAndBInterstitialType_ImpWithValidBannerObject.
@Test
public void whenAppendParametersAndBInterstitialType_ImpWithValidBannerObject() throws JSONException {
AdConfiguration adConfiguration = new AdConfiguration();
adConfiguration.setAdUnitIdentifierType(AdConfiguration.AdUnitIdentifierType.INTERSTITIAL);
adConfiguration.setAdPosition(AdPosition.FULLSCREEN);
BasicParameterBuilder builder = new BasicParameterBuilder(adConfiguration, mContext.getResources(), mBrowserActivityAvailable);
AdRequestInput adRequestInput = new AdRequestInput();
builder.appendBuilderParameters(adRequestInput);
BidRequest actualBidRequest = adRequestInput.getBidRequest();
BidRequest expectedBidRequest = getExpectedBidRequest(adConfiguration, actualBidRequest.getId());
assertEquals(expectedBidRequest.getJsonObject().toString(), actualBidRequest.getJsonObject().toString());
Imp actualImp = actualBidRequest.getImp().get(0);
assertNotNull(actualImp.banner);
Format expectedFormat = new Format(1920, 1080);
assertTrue(actualImp.banner.getFormats().contains(expectedFormat));
assertNull(actualImp.video);
assertEquals(1, actualImp.secure.intValue());
assertEquals(1, actualImp.instl.intValue());
}
Aggregations