Search in sources :

Example 6 with User

use of org.prebid.mobile.rendering.models.openrtb.bidRequests.User 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();
}
Also used : App(org.prebid.mobile.rendering.models.openrtb.bidRequests.App) User(org.prebid.mobile.rendering.models.openrtb.bidRequests.User) JSONObject(org.json.JSONObject) Device(org.prebid.mobile.rendering.models.openrtb.bidRequests.Device) ArrayList(java.util.ArrayList) Regs(org.prebid.mobile.rendering.models.openrtb.bidRequests.Regs) Imp(org.prebid.mobile.rendering.models.openrtb.bidRequests.Imp) Test(org.junit.Test)

Aggregations

User (org.prebid.mobile.rendering.models.openrtb.bidRequests.User)6 Test (org.junit.Test)4 JSONObject (org.json.JSONObject)3 AdConfiguration (org.prebid.mobile.rendering.models.AdConfiguration)3 BasicParameterBuilder (org.prebid.mobile.rendering.networking.parameters.BasicParameterBuilder)3 JSONArray (org.json.JSONArray)2 Ext (org.prebid.mobile.rendering.models.openrtb.bidRequests.Ext)2 Geo (org.prebid.mobile.rendering.models.openrtb.bidRequests.devices.Geo)2 ArrayList (java.util.ArrayList)1 DataObject (org.prebid.mobile.DataObject)1 AdSize (org.prebid.mobile.rendering.bidding.data.AdSize)1 BidRequest (org.prebid.mobile.rendering.models.openrtb.BidRequest)1 App (org.prebid.mobile.rendering.models.openrtb.bidRequests.App)1 Device (org.prebid.mobile.rendering.models.openrtb.bidRequests.Device)1 Imp (org.prebid.mobile.rendering.models.openrtb.bidRequests.Imp)1 Regs (org.prebid.mobile.rendering.models.openrtb.bidRequests.Regs)1