@Test public void testConfigFromPath() throws Exception { String configString = "a=1,b.c=X,d.e.f=Y"; PrintWriter writer = new PrintWriter("testconf.conf", "UTF-8"); writer.println(configString); writer.close(); Config config = ConfigUtils.configFromPath("testconf.conf"); Files.delete(Paths.get("testconf.conf")); assertEquals(config.getInt("a"), 1); assertEquals(config.getString("b.c"), "X"); assertEquals(config.getString("d.e.f"), "Y"); }
public static Config configFromPath(String path) { File configFile = new File(path); Config config; try { config = ConfigFactory.parseFile(configFile); } catch (ConfigException.Parse e) { if (e.getMessage().contains("Key '\"PK")) { throw new RuntimeException(JAR_FILE_EXCEPTION_MESSAGE); } else { throw e; } } return config; }
ConfigUtils { public static Config configFromPath(String path) { File configFile = new File(path); Config config; try { config = ConfigFactory.parseFile(configFile); } catch (ConfigException.Parse e) { if (e.getMessage().contains("Key '\"PK")) { throw new RuntimeException(JAR_FILE_EXCEPTION_MESSAGE); } else { throw e; } } return config; } }
ConfigUtils { public static Config configFromPath(String path) { File configFile = new File(path); Config config; try { config = ConfigFactory.parseFile(configFile); } catch (ConfigException.Parse e) { if (e.getMessage().contains("Key '\"PK")) { throw new RuntimeException(JAR_FILE_EXCEPTION_MESSAGE); } else { throw e; } } return config; }  }
ConfigUtils { public static Config configFromPath(String path) { File configFile = new File(path); Config config; try { config = ConfigFactory.parseFile(configFile); } catch (ConfigException.Parse e) { if (e.getMessage().contains("Key '\"PK")) { throw new RuntimeException(JAR_FILE_EXCEPTION_MESSAGE); } else { throw e; } } return config; }  static Config configFromPath(String path); static Config configFromResource(String resource); static Config applySubstitutions(Config config); static Config applySubstitutions(Config config, String substitutionsString); static Config getApplicationConfig(Config config); static Config mergeLoadedConfiguration(Config config); static Config findReplaceStringValues(Config config, String findRegex, Object replace); static boolean canBeCoerced(Config config, String path, ConfigValueType type); static T getOrElse(Config config, String path, T orElse); static T getOrNull(Config config, String path); }
ConfigUtils { public static Config configFromPath(String path) { File configFile = new File(path); Config config; try { config = ConfigFactory.parseFile(configFile); } catch (ConfigException.Parse e) { if (e.getMessage().contains("Key '\"PK")) { throw new RuntimeException(JAR_FILE_EXCEPTION_MESSAGE); } else { throw e; } } return config; }  static Config configFromPath(String path); static Config configFromResource(String resource); static Config applySubstitutions(Config config); static Config applySubstitutions(Config config, String substitutionsString); static Config getApplicationConfig(Config config); static Config mergeLoadedConfiguration(Config config); static Config findReplaceStringValues(Config config, String findRegex, Object replace); static boolean canBeCoerced(Config config, String path, ConfigValueType type); static T getOrElse(Config config, String path, T orElse); static T getOrNull(Config config, String path); static final String JAR_FILE_EXCEPTION_MESSAGE; }