/** * Test notification on setAll if there are already set indices. Changed implementation due to * RT-39776, test assumption incorrect. */ @Test public void testSetAllNotificationIfHasSet() { int[] indices = new int[] {3, 5, 1}; indicesList.addIndices(indices); report.clear(); indicesList.setAllIndices(); // report.prettyPrint(); assertEquals(items.size(), indicesList.size()); assertEquals(1, report.getEventCount()); Change c = report.getLastChange(); assertEquals(4, getChangeCount(c, ChangeType.ADDED)); }
/** * direct modification -> backingList change -> direct modification must reset sourceChange to * null */ @Test public void testChangeNullOnDirectSetAllAfterItemsModified() { 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); assertEquals("sanity", 1, report.getEventCount()); indicesList.setAllIndices(); assertEquals(null, indicesList.getSourceChange()); }
@Test public void testSetAllIndices() { indicesList.setAllIndices(); assertEquals(items.size(), indicesList.size()); assertEquals(1, report.getEventCount()); }