* @throws Exception
* the exception
*/
@Test
public void testMerge() throws Exception {
ListElement left = listFromProperties(leftNames, leftTimes);
ListElement right = listFromProperties(rightNames, rightTimes);
// deletion is handled programatically here:
MappingElement rightDelete = right.getElements().get(6L);
right.remove(rightDelete);
rightDelete.setLastModified(NEWEST_TIME_STAMP);
MappingElement leftDelete = left.getElements().get(7L);
left.remove(leftDelete);
leftDelete.setLastModified(NEWEST_TIME_STAMP);
// actually do the merge
ListElement merged = (ListElement) left.merge(right);
// check deletion
assertTrue("Entry 6 should be deleted", merged.getElements().get(6L)
.isDeleted());
assertTrue("Entry 7 should be deleted", merged.getElements().get(7L)
.isDeleted());
// check all properties
checkProperties(expectedNames, expectedTimes, merged);