AsyncIndexerService { static List<AsyncConfig> getAsyncConfig(String[] configs) { List<AsyncConfig> result = Lists.newArrayList(); for (String config : configs) { int idOfEq = config.indexOf(CONFIG_SEP); checkArgument(idOfEq > 0, "Invalid config provided [%s]", Arrays.toString(configs)); String name = config.substring(0, idOfEq).trim(); long interval = Long.parseLong(config.substring(idOfEq + 1)); result.add(new AsyncConfig(name, interval)); } return result; }  @Activate void activate(BundleContext bundleContext, Configuration config); @Deactivate void deactivate();  }
@Test public void configParsing() throws Exception{ List<AsyncConfig> configs = AsyncIndexerService.getAsyncConfig(new String[]{"async:15"}); assertEquals(1, configs.size()); assertEquals("async", configs.get(0).name); assertEquals(15, configs.get(0).timeIntervalInSecs); configs = AsyncIndexerService.getAsyncConfig(new String[]{"async:15", "foo-async:23"}); assertEquals(2, configs.size()); assertEquals("foo-async", configs.get(1).name); assertEquals(23, configs.get(1).timeIntervalInSecs); }