Configuration { public int getInt(String key, int defaultValue) { String stringValue = props.get(key); if (!isEmpty(stringValue)) { return Integer.parseInt(stringValue); } return defaultValue; } private  Configuration(File homeDir, Map<String, String> props); FileSystem fileSystem(); Locators locators(); FileLocation getFileLocationOfShared(String relativePath); String getString(String key); String getString(String key, @Nullable String defaultValue); @CheckForNull String getStringByKeys(String... keys); @CheckForNull String getStringByKeys(Predicate<String> validator, String... keys); int getInt(String key, int defaultValue); Map<String, String> asMap(); static Configuration createEnv(); static Configuration create(Properties properties); static Configuration create(Map<String, String> properties); static Configuration create(); static Builder builder();  }
@Test public void getInt() { Properties props = new Properties(); props.setProperty("one", "1"); Configuration config = Configuration.create(props); assertThat(config.getInt("one", -1)).isEqualTo(1); assertThat(config.getInt("two", -1)).isEqualTo(-1); }