@Test public void compareObjectsCollectionElementRemoved() { TestPerson newPerson = SerializationUtils.clone(oldPerson); newPerson.getAttributeList().remove(0); AcmDiff diff = diffService.compareObjects(oldPerson, newPerson); assertEquals(1, diff.getChangesAsList().size()); AcmChange change = diff.getChangesAsList().get(0); assertTrue(change.isLeaf()); assertTrue(change instanceof AcmCollectionElementRemoved); AcmChangeDisplayable displayable = (AcmChangeDisplayable) change; assertEquals("Value 1", displayable.getOldValue()); assertEquals(null, displayable.getNewValue()); }
public AcmDiff compareObjects(Object oldObj, Object newObj) { Map<Object, List<AcmChange>> alreadyProcessed = new HashMap<>(); AcmObjectChange acmObjectChange = compareObjects(null, null, oldObj, newObj, alreadyProcessed); AcmDiff diff = new AcmObjectDiff(acmObjectChange, getObjectConverter()); return diff; }
AcmDiffService { public AcmDiff compareObjects(Object oldObj, Object newObj) { Map<Object, List<AcmChange>> alreadyProcessed = new HashMap<>(); AcmObjectChange acmObjectChange = compareObjects(null, null, oldObj, newObj, alreadyProcessed); AcmDiff diff = new AcmObjectDiff(acmObjectChange, getObjectConverter()); return diff; } }
AcmDiffService { public AcmDiff compareObjects(Object oldObj, Object newObj) { Map<Object, List<AcmChange>> alreadyProcessed = new HashMap<>(); AcmObjectChange acmObjectChange = compareObjects(null, null, oldObj, newObj, alreadyProcessed); AcmDiff diff = new AcmObjectDiff(acmObjectChange, getObjectConverter()); return diff; }  }
AcmDiffService { public AcmDiff compareObjects(Object oldObj, Object newObj) { Map<Object, List<AcmChange>> alreadyProcessed = new HashMap<>(); AcmObjectChange acmObjectChange = compareObjects(null, null, oldObj, newObj, alreadyProcessed); AcmDiff diff = new AcmObjectDiff(acmObjectChange, getObjectConverter()); return diff; }  void initConfigurationMap(); AcmDiff compareObjects(Object oldObj, Object newObj); AcmCollectionChange compareCollections(Collection oldCollection, Collection newCollection); ObjectConverter getObjectConverter(); void setObjectConverter(ObjectConverter objectConverter); String getJsonConfiguration(); void setJsonConfiguration(String jsonConfiguration); }
AcmDiffService { public AcmDiff compareObjects(Object oldObj, Object newObj) { Map<Object, List<AcmChange>> alreadyProcessed = new HashMap<>(); AcmObjectChange acmObjectChange = compareObjects(null, null, oldObj, newObj, alreadyProcessed); AcmDiff diff = new AcmObjectDiff(acmObjectChange, getObjectConverter()); return diff; }  void initConfigurationMap(); AcmDiff compareObjects(Object oldObj, Object newObj); AcmCollectionChange compareCollections(Collection oldCollection, Collection newCollection); ObjectConverter getObjectConverter(); void setObjectConverter(ObjectConverter objectConverter); String getJsonConfiguration(); void setJsonConfiguration(String jsonConfiguration);  }