MultilingualStringInstanceBuilder extends AbstractInstanceBuilder { @Override void mergeChanges(Field field, Object target, Object originalValue, Object cloneValue) { MultilingualString clone = (MultilingualString) cloneValue; if (clone instanceof IndirectMultilingualString) { clone = ((IndirectMultilingualString) clone).unwrap(); } EntityPropertiesUtils .setFieldValue(field, target, clone != null ? new MultilingualString(clone.getValue()) : null); } MultilingualStringInstanceBuilder(CloneBuilderImpl builder, UnitOfWorkImpl uow);   }
@Test void mergeChangesCopiesValueOfCloneToOriginal() throws Exception { final MultilingualString clone = MultilingualString.create("building", Generators.LANG); clone.set("cs", "stavba"); final MultilingualString original = MultilingualString.create("construction", Generators.LANG); final OWLClassU target = new OWLClassU(); target.setSingularStringAtt(original); sut.mergeChanges(OWLClassU.getSingularStringAttField(), target, original, clone); assertEquals(clone.getValue(), target.getSingularStringAtt().getValue()); }
@Test void mergeChangesSupportsCloneBeingNull() throws Exception { final MultilingualString original = MultilingualString.create("construction", Generators.LANG); final OWLClassU target = new OWLClassU(); target.setSingularStringAtt(original); sut.mergeChanges(OWLClassU.getSingularStringAttField(), target, original, null); assertNull(target.getSingularStringAtt()); }