@Test
public void removeAllUnorderedGroupsFromNestedSectionNotifiesAtCorrectIndexes() throws Exception {
final Section rootSection = new Section();
rootSection.registerGroupDataObserver(groupAdapter);
groupAdapter.add(rootSection);
final Section nestedSection1 = new Section(Arrays.asList(new DummyItem(), new DummyItem(), new DummyItem()));
rootSection.add(nestedSection1);
final Section nestedSection2 = new Section(Collections.singletonList(new DummyItem()));
rootSection.add(nestedSection2);
final Section nestedSection3 = new Section(Arrays.asList(new DummyItem(), new DummyItem()));
rootSection.add(nestedSection3);
reset(groupAdapter);
rootSection.removeAll(Arrays.asList(nestedSection2, nestedSection3, nestedSection1));
final InOrder adapterCalls = inOrder(groupAdapter, groupAdapter, groupAdapter);
adapterCalls.verify(groupAdapter).onItemRangeRemoved(rootSection, 3, 1);
adapterCalls.verify(groupAdapter).onItemRangeRemoved(rootSection, 3, 2);
adapterCalls.verify(groupAdapter).onItemRangeRemoved(rootSection, 0, 3);
}