extract methods testRemoveThenSet and testAddThenSet, so we don't assume the full iterator contains more than one element