/** * {@inheritDoc} */ @Override protected AbstractPropertyUpdate<Long> createPropertyUpdate(Long updateValue) { return new BytePropertyUpdate(this, updateValue); }
@Test public void bytePropertyUpdateXmlSaveLoad() throws PropertyValidationException, JAXBException { long bytes = (10 * 1024 * 1024) + 2; // 10MBs + 2 bytes ByteProperty byteProperty = new ByteProperty("name", "description", "logical-name", Long.valueOf(1), false, false); AbstractPropertyUpdate<Long> bytePropertyUpdate = byteProperty.createAndValidatePropertyUpdate(Long.valueOf(bytes)); JAXBContext context = JAXBContext.newInstance(BytePropertyUpdate.class); Marshaller marshaller = context.createMarshaller(); Unmarshaller unmarshaller = context.createUnmarshaller(); marshaller.marshal(bytePropertyUpdate, f); Object object = unmarshaller.unmarshal(f); assertThat(object, is(instanceOf(BytePropertyUpdate.class))); BytePropertyUpdate unmarsalled = (BytePropertyUpdate) object; assertThat(byteProperty.canUpdate(unmarsalled), is(true)); byteProperty.setValue(unmarsalled.getUpdateValue()); assertThat(byteProperty.getValue().longValue(), is(bytes)); }