DbUnitConfigurationLoader { public static Properties loadConfiguration(final URL resourceUrl) { final Properties properties = new Properties(); try { if(resourceUrl != null) { properties.load(resourceUrl.openStream()); } } catch(final Exception e) { } return properties; } private  DbUnitConfigurationLoader(); static Properties loadConfiguration(final URL resourceUrl);  }
@Test public void testLoadingConfigurationGivenAnExistingFile() throws MalformedURLException { final URL url = existingConfigFile.toURI().toURL(); final Properties configuration = DbUnitConfigurationLoader.loadConfiguration(url); assertThat(configuration.getProperty(DatabaseConfig.FEATURE_QUALIFIED_TABLE_NAMES), equalTo("true")); assertThat(configuration.getProperty(DatabaseConfig.PROPERTY_BATCH_SIZE), equalTo("1000")); assertThat(configuration.keySet().size(), equalTo(2)); }
@Test public void testLoadingConfigurationGivenANotExistingFile() throws MalformedURLException { final URL url = notExistingConfigFile.toURI().toURL(); final Properties configuration = DbUnitConfigurationLoader.loadConfiguration(url); assertTrue(configuration.keySet().isEmpty()); }