@Test(expected = ConfigException.class) public void testParseBadListToMap() { assertEquals( new HashMap(), Application.parseListToMap(Arrays.asList("k1:v1:what", "k2:v2")) ); }
public static Map<String, String> parseListToMap(List<String> list) { Map<String, String> configuredTags = new HashMap<>(); for (String entry : list) { String[] keyValue = entry.split("\\s*:\\s*", -1); if (keyValue.length != 2) { throw new ConfigException("Map entry should be of form <key>:<value"); } configuredTags.put(keyValue[0], keyValue[1]); } return configuredTags; }
Application { public static Map<String, String> parseListToMap(List<String> list) { Map<String, String> configuredTags = new HashMap<>(); for (String entry : list) { String[] keyValue = entry.split("\\s*:\\s*", -1); if (keyValue.length != 2) { throw new ConfigException("Map entry should be of form <key>:<value"); } configuredTags.put(keyValue[0], keyValue[1]); } return configuredTags; } }
Application { public static Map<String, String> parseListToMap(List<String> list) { Map<String, String> configuredTags = new HashMap<>(); for (String entry : list) { String[] keyValue = entry.split("\\s*:\\s*", -1); if (keyValue.length != 2) { throw new ConfigException("Map entry should be of form <key>:<value"); } configuredTags.put(keyValue[0], keyValue[1]); } return configuredTags; } Application(T config);  Application(T config, String path); }
Application { public static Map<String, String> parseListToMap(List<String> list) { Map<String, String> configuredTags = new HashMap<>(); for (String entry : list) { String[] keyValue = entry.split("\\s*:\\s*", -1); if (keyValue.length != 2) { throw new ConfigException("Map entry should be of form <key>:<value"); } configuredTags.put(keyValue[0], keyValue[1]); } return configuredTags; } Application(T config);  Application(T config, String path); final String getPath(); final Metrics getMetrics(); abstract void setupResources(Configurable<?> config, T appConfig); Map<String,String> getMetricsTags(); Server createServer(); static Map<String, String> parseListToMap(List<String> list); Handler wrapWithGzipHandler(Handler handler); static List<URI> parseListeners(
          List<String> listenersConfig,
          int deprecatedPort,
          List<String> supportedSchemes,
          String defaultScheme
  ); void configureBaseApplication(Configurable<?> config); void configureBaseApplication(Configurable<?> config, Map<String, String> metricTags); T getConfiguration(); void start(); void join(); void stop(); void onShutdown(); }
Application { public static Map<String, String> parseListToMap(List<String> list) { Map<String, String> configuredTags = new HashMap<>(); for (String entry : list) { String[] keyValue = entry.split("\\s*:\\s*", -1); if (keyValue.length != 2) { throw new ConfigException("Map entry should be of form <key>:<value"); } configuredTags.put(keyValue[0], keyValue[1]); } return configuredTags; } Application(T config);  Application(T config, String path); final String getPath(); final Metrics getMetrics(); abstract void setupResources(Configurable<?> config, T appConfig); Map<String,String> getMetricsTags(); Server createServer(); static Map<String, String> parseListToMap(List<String> list); Handler wrapWithGzipHandler(Handler handler); static List<URI> parseListeners(
          List<String> listenersConfig,
          int deprecatedPort,
          List<String> supportedSchemes,
          String defaultScheme
  ); void configureBaseApplication(Configurable<?> config); void configureBaseApplication(Configurable<?> config, Map<String, String> metricTags); T getConfiguration(); void start(); void join(); void stop(); void onShutdown();  }