コード例 #1
0
 @Test
 public void testSetAlreadySetNoNotification() {
   int[] indices = new int[] {3, 5, 1};
   indicesList.addIndices(indices);
   report.clear();
   indicesList.setIndices(indices);
   assertEquals(0, report.getEventCount());
 }
コード例 #2
0
 @Test
 public void testItemSetAt() {
   int index = 3;
   indicesList.setIndices(index);
   report.clear();
   items.set(index, "replaced-element-at-3");
   assertEquals(1, indicesList.size());
   assertEquals(index, indicesList.get(0).intValue());
   assertEquals(0, report.getEventCount());
 }
コード例 #3
0
 @Test
 public void testChangeNullOnDirectSetAfterItemsModified() {
   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.setIndices(6);
   assertEquals(null, indicesList.getSourceChange());
 }
コード例 #4
0
 @Test
 public void testSetIndices() {
   int[] indices = new int[] {3, 5, 1};
   indicesList.addIndices(indices);
   report.clear();
   int[] setIndices = new int[] {2, 4, 6, 7};
   indicesList.setIndices(setIndices);
   assertEquals(setIndices.length, indicesList.size());
   assertEquals(1, report.getEventCount());
   assertTrue(wasSingleReplaced(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());
 }
コード例 #5
0
 @Test
 public void testChangeNullOnDirectSet() {
   indicesList.setIndices(0);
   assertEquals(null, indicesList.getSourceChange());
 }
コード例 #6
0
 /** Sanity: single remove at index removes indexed */
 @Test
 public void testItemRemovedAt() {
   indicesList.setIndices(3);
   items.remove(3);
   assertEquals(0, indicesList.size());
 }