@Test public void testChangeNullOnDirectClearAllAfterItemsModified() { int[] indices = new int[] {3, 5, 1}; indicesList.addIndices(indices); report.clear(); ListChangeReport itemsReport = new ListChangeReport(items); // new PrintingListChangeListener("Items removed before", indicesList); items.remove(0); indicesList.clearAllIndices(); assertEquals(null, indicesList.getSourceChange()); }
@Test public void testClearAll() { int[] indices = new int[] {3, 5, 1}; indicesList.addIndices(indices); report.clear(); indicesList.clearAllIndices(); assertEquals(0, indicesList.size()); assertEquals(1, report.getEventCount()); assertTrue(wasSingleRemoved(report.getLastChange())); Change c = report.getLastChange(); // report.prettyPrint(); c.reset(); c.next(); Arrays.sort(indices); List base = new ArrayList(); for (int i = 0; i < indices.length; i++) { base.add(indices[i]); } assertEquals(base, c.getRemoved()); }