@Override protected AbstractPropertyUpdate<Long> createPropertyUpdate(Long updateValue) { return new LongPropertyUpdate(this, updateValue); }
@Test public void longPropertyUpdateXmlSaveLoad() throws PropertyValidationException, JAXBException { long value = new Random().nextLong(); if (1 == value) { // make sure we don't update with same value value++; } LongProperty longProperty = new LongProperty("name", "description", "logical-name", Long.valueOf(1), false, false); AbstractPropertyUpdate<Long> longPropertyUpdate = longProperty.createAndValidatePropertyUpdate(Long.valueOf(value)); JAXBContext context = JAXBContext.newInstance(LongPropertyUpdate.class); Marshaller marshaller = context.createMarshaller(); Unmarshaller unmarshaller = context.createUnmarshaller(); marshaller.marshal(longPropertyUpdate, f); Object object = unmarshaller.unmarshal(f); assertThat(object, is(instanceOf(LongPropertyUpdate.class))); LongPropertyUpdate unmarsalled = (LongPropertyUpdate) object; assertThat(longProperty.canUpdate(unmarsalled), is(true)); longProperty.setValue(unmarsalled.getUpdateValue()); assertThat(longProperty.getValue().longValue(), is(value)); }