@Test
@SuppressWarnings("unchecked")
public void savedPropertyRestoreToDefaultUpdate() throws JAXBException, IOException, SAXException {
String defaultValue = "value1";
Configuration configuration = new Configuration();
PropertySection section = new PropertySection();
SingleProperty<String> property = new StringProperty("", "", "property1", defaultValue, false, false);
property.setValue("someotherthandefault");
section.addProperty(property);
configuration.addSection(section);
doReturn(configuration).when(transformator).unmarshall(Matchers.<Path> anyObject(), Matchers.<Path> anyObject(), eq(Configuration.class));
doReturn(configurationUpdate).when(transformator).unmarshall(Matchers.<Path> anyObject(), Matchers.<Path> anyObject(), eq(ConfigurationUpdate.class));
AbstractPropertyUpdate<String> propertyUpdate = mock(AbstractPropertyUpdate.class);
when(propertyUpdate.getPropertyLogicalName()).thenReturn("property1");
when(propertyUpdate.isRestoreDefault()).thenReturn(true);
when(configurationUpdate.getPropertyUpdates()).thenReturn(Collections.<IPropertyUpdate<?>> singleton(propertyUpdate));
Properties properties = propertyManager.getProperties();
assertThat(properties.getProperty("property1"), is(equalTo(defaultValue)));
assertThat(properties.size(), is(1));
}