コード例 #1
0
 @Test
 public void testClearUnsetNoNotification() {
   int[] indices = new int[] {3, 5, 1};
   indicesList.addIndices(indices);
   report.clear();
   indicesList.clearIndices(2);
   assertEquals(0, report.getEventCount());
 }
コード例 #2
0
 @Test
 public void testChangeNullOnDirectClearAfterItemsModified() {
   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.clearIndices(1, 2, 3, 4);
   assertEquals(null, indicesList.getSourceChange());
 }
コード例 #3
0
 @Test
 public void testClearSomeIndicesNotification() {
   int[] indices = new int[] {3, 5, 1};
   indicesList.addIndices(indices);
   report.clear();
   int[] clear = new int[] {5, 1};
   //        new PrintingListChangeListener("clearSomeNotification", indicesList);
   indicesList.clearIndices(clear);
   assertEquals(1, indicesList.size());
   assertEquals(1, report.getEventCount());
   assertEquals(
       "must be 2 disjoint removes",
       2,
       getChangeCount(report.getLastChange(), ChangeType.REMOVED));
 }
コード例 #4
0
 @Test
 public void testClearIndicesNotification() {
   int[] indices = new int[] {3, 5, 1};
   indicesList.addIndices(indices);
   report.clear();
   indicesList.clearIndices(indices);
   assertEquals(0, indicesList.size());
   assertEquals(1, report.getEventCount());
   assertTrue("must be single remove", wasSingleRemoved(report.getLastChange()));
   Change c = report.getLastChange();
   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());
 }