Search in sources :

Example 16 with BasicParameterBuilder

use of org.prebid.mobile.rendering.networking.parameters.BasicParameterBuilder in project prebid-mobile-android by prebid.

the class BasicParameterBuilderTest method whenAppendParametersAndAdConfigContextDataNotEmpty_ContextDataAddedToImpExt.

@Test
public void whenAppendParametersAndAdConfigContextDataNotEmpty_ContextDataAddedToImpExt() throws JSONException {
    AdConfiguration adConfiguration = new AdConfiguration();
    adConfiguration.addContextData("context", "contextData");
    BasicParameterBuilder builder = new BasicParameterBuilder(adConfiguration, mContext.getResources(), false);
    AdRequestInput adRequestInput = new AdRequestInput();
    builder.appendBuilderParameters(adRequestInput);
    Ext impExt = adRequestInput.getBidRequest().getImp().get(0).getExt();
    assertTrue(impExt.getMap().containsKey("context"));
    JSONObject contextDataJson = ((JSONObject) impExt.getMap().get("context")).getJSONObject("data");
    assertTrue(contextDataJson.has("context"));
    assertEquals("contextData", contextDataJson.getJSONArray("context").get(0));
}
Also used : Ext(org.prebid.mobile.rendering.models.openrtb.bidRequests.Ext) JSONObject(org.json.JSONObject) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) BasicParameterBuilder(org.prebid.mobile.rendering.networking.parameters.BasicParameterBuilder) Test(org.junit.Test)

Aggregations

BasicParameterBuilder (org.prebid.mobile.rendering.networking.parameters.BasicParameterBuilder)16 Test (org.junit.Test)15 AdConfiguration (org.prebid.mobile.rendering.models.AdConfiguration)15 AdSize (org.prebid.mobile.rendering.bidding.data.AdSize)9 Imp (org.prebid.mobile.rendering.models.openrtb.bidRequests.Imp)8 BidRequest (org.prebid.mobile.rendering.models.openrtb.BidRequest)7 JSONObject (org.json.JSONObject)4 JSONArray (org.json.JSONArray)3 User (org.prebid.mobile.rendering.models.openrtb.bidRequests.User)3 Ext (org.prebid.mobile.rendering.models.openrtb.bidRequests.Ext)2 Context (android.content.Context)1 Resources (android.content.res.Resources)1 ArrayList (java.util.ArrayList)1 DataObject (org.prebid.mobile.DataObject)1 Format (org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.pmps.Format)1 AppInfoParameterBuilder (org.prebid.mobile.rendering.networking.parameters.AppInfoParameterBuilder)1 DeviceInfoParameterBuilder (org.prebid.mobile.rendering.networking.parameters.DeviceInfoParameterBuilder)1 GeoLocationParameterBuilder (org.prebid.mobile.rendering.networking.parameters.GeoLocationParameterBuilder)1 NetworkParameterBuilder (org.prebid.mobile.rendering.networking.parameters.NetworkParameterBuilder)1 ParameterBuilder (org.prebid.mobile.rendering.networking.parameters.ParameterBuilder)1