public void testSaveWithDataConfiguration() throws ConfigurationException
{
File file = new File("target/testsave.properties");
if (file.exists()) {
assertTrue(file.delete());
}
PropertiesConfiguration config = new PropertiesConfiguration(file);
DataConfiguration dataConfig = new DataConfiguration(config);
dataConfig.setProperty("foo", "bar");
assertEquals("bar", config.getProperty("foo"));
config.save();
PropertiesConfiguration config2 = new PropertiesConfiguration(file);
assertFalse("empty configuration", config2.isEmpty());
}
Maybe in 2.0 we should consider reimplementing this class as a true decorator. To be safe it should not extend AbstractConfiguration, but implement all methods required by the Configuration interface manually - delegating to the wrapped configuration.