Config extends AbstractConfig { private void fromProperties(Properties properties) { for (String key : properties.stringPropertyNames()) { put(key, properties.getProperty(key)); } } Config();  Config(Config other);  Config(String propertiesFile);  Config(InputStream inputStream);  Config(Properties properties);  Config(Map<String, String> properties); @Override String get(String key); @Override String get(String key, Object defaultValue); @Override int getInt(String key); @Override int getInt(String key, int defaultValue); @Override long getLong(String key); @Override long getLong(String key, long defaultValue); @Override double getDouble(String key); @Override double getDouble(String key, double defaultValue); @Override boolean getBoolean(String key); @Override boolean getBoolean(String key, boolean defaultValue); void put(String key, int value); void put(String key, long value); void put(String key, double value); void put(String key, boolean value); @Override String toString();  }
@Test public void testFromProperties() throws IOException { Properties properties = new Properties(); InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("config.properties"); properties.load(inputStream); Config cfg = new Config(properties); assertEquals(100, cfg.getInt("a")); assertEquals("hello", cfg.get("b")); assertTrue(cfg.getBoolean("c")); }