public void testMergeWithEquivalentRemovePresent() throws Exception { Remove expectedRemove = Remove.create(ssb); delta.addChange(expectedRemove); remove.setChild(ssb); remove.mergeInto(delta, NOW); assertEquals("Duplicate remove should not have been added", 1, delta.getChanges().size()); assertEquals(expectedRemove, delta.getChanges().get(0)); }
public void testDeepEqualsWithMismatchedChanges() throws Exception { Amendment a = new Amendment(); a.getDeltas() .add( setGridId( "D1", Delta.createDeltaFor( setGridId("PC1", new PlannedCalendar()), Add.create(setGridId("E1", new Epoch()))))); Amendment b = new Amendment(); b.getDeltas() .add( setGridId( "D1", Delta.createDeltaFor( setGridId("PC1", new PlannedCalendar()), Remove.create(setGridId("E1", new Epoch()))))); assertChildDifferences( a.deepEquals(b), new String[] {"delta for planned calendar PC1"}, "add of epoch:E1 replaced by remove of epoch:E1"); }
public void testDeepEqualsWhenRemoveHasDifferentChild() throws Exception { Remove remove1 = Remove.create(setGridId("e1", Epoch.create("E1"))); Remove remove2 = Remove.create(setGridId("e2", Epoch.create("E2"))); assertDifferences(remove1.deepEquals(remove2), "for different child"); }
public void testEqualsWhenRemoveHasDifferentChild() throws Exception { Remove remove1 = Remove.create(createNamedInstance("Epoch1", Epoch.class)); Remove remove2 = Remove.create(createNamedInstance("Segment2", StudySegment.class)); assertNotEquals("Removes are equals", remove1, remove2); }
public void testEqualsWhenRemoveHasSameChild() throws Exception { Remove remove1 = Remove.create(createNamedInstance("Segment1", StudySegment.class)); Remove remove2 = Remove.create(createNamedInstance("Segment1", StudySegment.class)); assertEquals("Removes are not equals", remove1, remove2); }