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

    // Test invalid visible property JSONObject
    try {
        JSONObject visProperties = new JSONObject();
        visProperties.put(InfoWindowConfig.KEY_VP_LABEL, "");
        visProperties.put(InfoWindowConfig.KEY_VP_ID, "id");
        JSONArray array1 = new JSONArray();
        array1.put(visProperties);
        JSONObject object1 = new JSONObject();
        object1.put(InfoWindowConfig.KEY_VISIBLE_PROPERTIES, array1);
        new InfoWindowConfig(object1);
        Assert.fail("InvalidMapBoxStyleException not thrown for an incorrect visible property");
    } catch (InvalidMapBoxStyleException e) {
    }
    // Test constructor using JSONObject
    JSONObject visProperties = new JSONObject();
    String label = "label1";
    String id = "id1";
    visProperties.put(InfoWindowConfig.KEY_VP_LABEL, label);
    visProperties.put(InfoWindowConfig.KEY_VP_ID, id);
    JSONArray array2 = new JSONArray();
    array2.put(visProperties);
    JSONObject object2 = new JSONObject();
    object2.put(InfoWindowConfig.KEY_VISIBLE_PROPERTIES, array2);
    InfoWindowConfig config1 = new InfoWindowConfig(object2);
    Assert.assertEquals(config1.getVisibleProperties().length(), 1);
    Assert.assertEquals(config1.getVisibleProperties()
            .getJSONObject(0).getString(InfoWindowConfig.KEY_VP_ID), id);
    Assert.assertEquals(config1.getVisibleProperties()
            .getJSONObject(0).getString(InfoWindowConfig.KEY_VP_LABEL), label);
}