final DomainObject entity = new DomainObjectImpl();
entity.setValue("entityVal1");
entity.setValue2("entityVal2");
entity.setTimestamp(time);
final ExtendedDataTransferObject dto = new AnnotatedExtendedDataTransferObjectImpl();
final DomainObject res = (DomainObject) service.entityToDtoAndBackToEntity(dto, entity, new Object());
assertEquals(entity.getValue(), "entityVal1");
assertEquals(entity.getValue2(), "entityVal2");
assertEquals(entity.getTimestamp(), time);
assertNotSame(res, entity);
assertEquals(dto.getValue(), "entityVal2");
assertEquals(dto.getValue2(), "entityVal1");
assertNotNull(dto.getTimestamp());
assertTrue(dto.getTimestamp().after(entity.getTimestamp()));
assertEquals(res.getValue(), "entityVal2");
assertEquals(res.getValue2(), "entityVal1");
assertNull(res.getTimestamp());