InfoWindowConfig implements Config { public JSONArray getVisibleProperties() { return visibleProperties; } InfoWindowConfig();  InfoWindowConfig(JSONObject config); JSONArray getVisibleProperties(); void setVisibleProperties(@NonNull JSONArray visibleProperties); void addVisibleProperty(@NonNull String id, @NonNull String label); @Override boolean isValid(); @Override JSONObject toJsonObject(); static final String KEY_VISIBLE_PROPERTIES; static final String KEY_VP_ID; static final String KEY_VP_LABEL; }
@Test public void testConstructor() throws JSONException, InvalidMapBoxStyleException { 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) { } 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); }