@Override public GoogleClientSecretsForApiBuilder fromFile(String path) throws ConfigurationLoadException { return from(configHelper.fromFile(path), path); }
@Override public GoogleClientSecretsForApiBuilder fromFile(String path) throws ConfigurationLoadException { return from(configHelper.fromFile(path), path); }
@Override public Builder fromFile(String path) throws ConfigurationLoadException { return from(configHelper.fromFile(path)); }
@Override public ForApiBuilder fromFile(String path) throws ConfigurationLoadException { return from(configHelper.fromFile(path), path.toString()); }
@Override public Builder fromFile(String path) throws ConfigurationLoadException { return from(configHelper.fromFile(path)); }
@Override public Builder fromFile(URL path) throws ConfigurationLoadException { return from(configHelper.fromFile(path)); }
@Override public Builder fromFile(URL path) throws ConfigurationLoadException { return from(configHelper.fromFile(path)); }
@Override public GoogleClientSecretsForApiBuilder fromFile(URL path) throws ConfigurationLoadException { return from(configHelper.fromFile(path), path.toString()); }
@Override public Builder fromFile(String path) throws ConfigurationLoadException { return from(configHelper.fromFile(path)); }
@Override public GoogleClientSecretsForApiBuilder fromFile(File path) throws ConfigurationLoadException { return from(configHelper.fromFile(path), path.getAbsolutePath()); }
@Override public GoogleClientSecretsForApiBuilder fromFile(URL path) throws ConfigurationLoadException { return from(configHelper.fromFile(path), path.toString()); }
@Override public ForApiBuilder fromFile(String path) throws ConfigurationLoadException { return from(configHelper.fromFile(path), path.toString()); }
@Override public ForApiBuilder fromFile(URL path) throws ConfigurationLoadException { return from(configHelper.fromFile(path), path.toString()); }
@Test public void testFromFile_urlDoesNotExist() throws Exception { thrown.expect(ConfigurationLoadException.class); configurationHelper.fromFile(new URL("file:///" + System.currentTimeMillis())); }
@Test public void testFromFile_stringDoesNotExist() throws Exception { thrown.expect(ConfigurationLoadException.class); configurationHelper.fromFile("/" + System.currentTimeMillis()); }
@Test public void testFromFile_urlClasspathExists() throws Exception { Configuration configuration = configurationHelper.fromFile(ConfigurationHelperTest.class .getResource("props/test1.properties")); assertPropertiesEquals(test1Properties, configuration); }
@Test public void testFromFile_stringExists() throws Exception { Configuration configuration = configurationHelper.fromFile(createPropertiesFile(test1Properties).toString()); assertPropertiesEquals(test1Properties, configuration); }
@Test public void testFromFile_fileExists() throws Exception { Configuration configuration = configurationHelper.fromFile(createPropertiesFile(test1Properties)); assertPropertiesEquals(test1Properties, configuration); }
/** * Asserts that reading list values from a properties file works properly when the default * list delimiter is not modified. */ @Test public void testFromFile_listValuesWithDefaultDelimiterUnchanged() throws Exception { Configuration configuration = configurationHelper.fromFile(ConfigurationHelperTest.class .getResource("props/test3.properties")); assertPropertiesEquals(test3Properties, configuration); String[] stringArray = configuration.getStringArray("i.j.k"); assertArrayEquals(new String[]{"foo", "bar"}, stringArray); }
/** * Asserts that reading list values from a properties file works properly when the default * list delimiter is modified. */ @Test public void testFromFile_listValuesWithDefaultDelimiterChanged() throws Exception { AbstractConfiguration.setDefaultListDelimiter('|'); Configuration configuration = configurationHelper.fromFile( ConfigurationHelperTest.class.getResource("props/test3.properties")); assertPropertiesEquals(test3Properties, configuration); String[] stringArray = configuration.getStringArray("i.j.k"); assertArrayEquals(new String[] {"foo", "bar"}, stringArray); }