@Test
public void toJsonObject() throws JSONException, InvalidMapBoxStyleException {

    // Test when values set using constructor with JSONObject
    int size = 4;
    JSONArray array1 = new JSONArray();
    for (int i = 0; i < size; i++) {
        JSONObject visProperties = new JSONObject();
        visProperties.put(InfoWindowConfig.KEY_VP_LABEL, "label" + String.valueOf(i));
        visProperties.put(InfoWindowConfig.KEY_VP_ID, "id" + String.valueOf(i));
        array1.put(visProperties);
    }
    JSONObject object1 = new JSONObject();
    object1.put(InfoWindowConfig.KEY_VISIBLE_PROPERTIES, array1);
    InfoWindowConfig config1 = new InfoWindowConfig(object1);
    Assert.assertEquals(config1.toJsonObject().getJSONArray(
            InfoWindowConfig.KEY_VISIBLE_PROPERTIES).length(), size);
    for (int i = 0; i < size; i++) {
        Assert.assertEquals(config1.toJsonObject().getJSONArray(
                InfoWindowConfig.KEY_VISIBLE_PROPERTIES).getJSONObject(i)
                        .getString(InfoWindowConfig.KEY_VP_ID), "id" + String.valueOf(i));
        Assert.assertEquals(config1.toJsonObject().getJSONArray(
                InfoWindowConfig.KEY_VISIBLE_PROPERTIES).getJSONObject(i)
                        .getString(InfoWindowConfig.KEY_VP_LABEL), "label" + String.valueOf(i));
    }
    Assert.assertNotSame(config1.toJsonObject(), object1);
}