task.writeDelta(task.calculateDelta(src, dest), mockWriter);
assertTrue(task.m_calledWith.isEmpty(), "Delta of two empty lists should be empty");
// add something to the source
src.add(new Descriptor(targetID, 1, new SortedRangeSet("1-5")));
task.writeDelta(task.calculateDelta(src, dest), mockWriter);
assertEquals(task.size(), 1, "Incorrect delta");
task.clear();
// add an overlapping destination
dest.add(new Descriptor(targetID, 1, new SortedRangeSet("1-3")));
task.writeDelta(task.calculateDelta(src, dest), mockWriter);
assertEquals(task.size(), 1, "Incorrect delta");
RangeIterator i = task.m_calledWith.get(0).getRangeSet().iterator();
assertEquals(i.next(), 4, "Illegal value in SortedRangeSet");
assertEquals(i.next(), 5, "Illegal value in SortedRangeSet");
assertFalse(i.hasNext(), "Illegal value in SortedRangeSet");
task.clear();
// add a non-overlapping destination
dest.add(new Descriptor(targetID, 2, new SortedRangeSet("50-100")));
task.writeDelta(task.calculateDelta(src, dest), mockWriter);
assertEquals(task.size(), 1, "Incorrect delta");
i = task.m_calledWith.get(0).getRangeSet().iterator();
assertEquals(i.next(), 4, "Illegal value in SortedRangeSet");
assertEquals(i.next(), 5, "Illegal value in SortedRangeSet");
assertFalse(i.hasNext(), "Illegal value in SortedRangeSet");
task.clear();
// add non-overlapping source
src.add(new Descriptor(targetID, 2, new SortedRangeSet("1-49")));
task.writeDelta(task.calculateDelta(src, dest), mockWriter);
assertEquals(task.size(), 2, "Incorrect delta");
task.clear();
// add a source with gaps
src.add(new Descriptor(targetID, 3, new SortedRangeSet("1-10")));
dest.add(new Descriptor(targetID, 3, new SortedRangeSet("3,5-8")));
task.writeDelta(task.calculateDelta(src, dest), mockWriter);
assertEquals(task.size(), 3, "Incorrect delta");
for (Descriptor l : task.m_calledWith) {
if (l.getStoreID() == 3) {