DataSourceConfig implements Config { public static String[] extractDataSourceNames(@NonNull ArrayList<DataSourceConfig> dataSourceConfigs) { String[] names = new String[dataSourceConfigs.size()]; for (int i = 0; i < dataSourceConfigs.size(); i++) { names[i] = dataSourceConfigs.get(i).getName(); } return names; } 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 testExtractDataSourceNames() throws InvalidMapBoxStyleException { Assert.assertEquals(0, DataSourceConfig.extractDataSourceNames(new ArrayList<DataSourceConfig>()).length); ArrayList<DataSourceConfig> configs1 = new ArrayList<>(); int size1 = 6; for (int i = 0; i < size1; i++) { configs1.add(new DataSourceConfig(String.valueOf(i))); } String[] names1 = DataSourceConfig.extractDataSourceNames(configs1); Assert.assertEquals(size1, names1.length); for (int i = 0; i < names1.length; i++) { Assert.assertEquals(String.valueOf(i), names1[i]); } }