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));
}
Aggregations