use of org.prebid.mobile.rendering.models.openrtb.bidRequests.Imp in project prebid-mobile-android by prebid.
the class BidRequestTest method getJsonObject.
@Test
public void getJsonObject() throws Exception {
BidRequest bidReq = new BidRequest();
App app = new App();
app.id = "auid";
bidReq.setApp(app);
Device device = new Device();
device.h = 1111;
bidReq.setDevice(device);
Imp imp = new Imp();
imp.instl = 0;
ArrayList<Imp> imps = new ArrayList<>();
imps.add(imp);
bidReq.setImp(imps);
Regs regs = new Regs();
regs.coppa = 0;
bidReq.setRegs(regs);
User user = new User();
user.keywords = "q, o";
bidReq.setUser(user);
JSONObject actualObj = bidReq.getJsonObject();
String expectedString = "{\"app\":{\"id\":\"auid\"},\"regs\":{\"coppa\":0},\"imp\":[{\"instl\":0}],\"device\":{\"h\":1111},\"user\":{\"keywords\":\"q, o\"}}";
assertEquals("got: " + actualObj.toString(), expectedString, actualObj.toString());
bidReq.getJsonObject();
}
use of org.prebid.mobile.rendering.models.openrtb.bidRequests.Imp in project prebid-mobile-android by prebid.
the class BasicParameterBuilderTest method whenAppendParametersAndUseExternalBrowserFalseAndBrowserActivityAvailable_ClickBrowserEqualsZero.
@Test
public void whenAppendParametersAndUseExternalBrowserFalseAndBrowserActivityAvailable_ClickBrowserEqualsZero() {
AdConfiguration adConfiguration = new AdConfiguration();
adConfiguration.setAdUnitIdentifierType(AdConfiguration.AdUnitIdentifierType.BANNER);
adConfiguration.addSize(new AdSize(320, 50));
PrebidRenderingSettings.useExternalBrowser = false;
BasicParameterBuilder builder = new BasicParameterBuilder(adConfiguration, mContext.getResources(), mBrowserActivityAvailable);
AdRequestInput adRequestInput = new AdRequestInput();
builder.appendBuilderParameters(adRequestInput);
Imp actualImp = adRequestInput.getBidRequest().getImp().get(0);
assertEquals(0, actualImp.clickBrowser.intValue());
}
use of org.prebid.mobile.rendering.models.openrtb.bidRequests.Imp 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