DataSourceConfig implements Config { @Override public JSONObject toJsonObject() throws JSONException { JSONObject object = new JSONObject(); object.put(KEY_NAME, name); return object; } DataSourceConfig();  DataSourceConfig(@NonNull String name);  DataSourceConfig(JSONObject jsonObject); @Override boolean isValid(); String getName(); void setName(@NonNull String name); @Override JSONObject toJsonObject(); static String[] extractDataSourceNames(@NonNull ArrayList<DataSourceConfig> dataSourceConfigs); static final String KEY_NAME; }
@Test public void testToJsonObject() throws JSONException, InvalidMapBoxStyleException { String name1 = "test"; JSONObject object1 = new JSONObject(); object1.put(DataSourceConfig.KEY_NAME, name1); DataSourceConfig config1 = new DataSourceConfig(object1); Assert.assertEquals(object1.toString(), config1.toJsonObject().toString()); Assert.assertNotSame(object1, config1.toJsonObject()); }