Exemplo n.º 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());
 }
Exemplo n.º 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());
 }
Exemplo n.º 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());
 }
Exemplo n.º 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());
 }
Exemplo n.º 5
0
 @Test
 public void testChangeNullOnDirectSet() {
   indicesList.setIndices(0);
   assertEquals(null, indicesList.getSourceChange());
 }
Exemplo n.º 6
0
 /** Sanity: single remove at index removes indexed */
 @Test
 public void testItemRemovedAt() {
   indicesList.setIndices(3);
   items.remove(3);
   assertEquals(0, indicesList.size());
 }