@Test public void shouldReadConfigFile() throws IOException { List<String> lines = Arrays.asList("credentials.username=someuser2", "credentials.password=secret"); assertThat(directory.mkdirs()).isTrue(); File file = new File(directory, "testApp.properties"); Files.write(file.toPath(), lines); ConfigMap configuration = ConfigMap.read(file); assertThat(configuration).containsEntry("credentials.username", "someuser2"); }
public static ConfigMap read(File file) throws IOException { Properties properties = new Properties(); try (FileReader reader = new FileReader(file)) { properties.load(reader); } return new ConfigMap(properties); }
ConfigMap extends AbstractMap<String, String> { public static ConfigMap read(File file) throws IOException { Properties properties = new Properties(); try (FileReader reader = new FileReader(file)) { properties.load(reader); } return new ConfigMap(properties); } }
ConfigMap extends AbstractMap<String, String> { public static ConfigMap read(File file) throws IOException { Properties properties = new Properties(); try (FileReader reader = new FileReader(file)) { properties.load(reader); } return new ConfigMap(properties); } ConfigMap(String prefix, Map<String, String> innerMap);  ConfigMap(Map<String, String> innerMap);  ConfigMap();  ConfigMap(Properties properties); }
ConfigMap extends AbstractMap<String, String> { public static ConfigMap read(File file) throws IOException { Properties properties = new Properties(); try (FileReader reader = new FileReader(file)) { properties.load(reader); } return new ConfigMap(properties); } ConfigMap(String prefix, Map<String, String> innerMap);  ConfigMap(Map<String, String> innerMap);  ConfigMap();  ConfigMap(Properties properties); static ConfigMap read(File file); Optional<String> optional(Object key); @Override String get(Object key); @Override String getOrDefault(Object key, String defaultValue); boolean getBoolean(String key); @Override @NonNull Set<Entry<String, String>> entrySet(); Collection<String> listSubMaps(); ConfigMap getRoot(); Optional<ConfigMap> subMap(String prefix); @Override String toString(); }
ConfigMap extends AbstractMap<String, String> { public static ConfigMap read(File file) throws IOException { Properties properties = new Properties(); try (FileReader reader = new FileReader(file)) { properties.load(reader); } return new ConfigMap(properties); } ConfigMap(String prefix, Map<String, String> innerMap);  ConfigMap(Map<String, String> innerMap);  ConfigMap();  ConfigMap(Properties properties); static ConfigMap read(File file); Optional<String> optional(Object key); @Override String get(Object key); @Override String getOrDefault(Object key, String defaultValue); boolean getBoolean(String key); @Override @NonNull Set<Entry<String, String>> entrySet(); Collection<String> listSubMaps(); ConfigMap getRoot(); Optional<ConfigMap> subMap(String prefix); @Override String toString();  }