Changeset f238d05


Ignore:
Timestamp:
Nov 23, 2012 7:13:21 AM (7 years ago)
Author:
zab <zab@…>
Branches:
master
Children:
0ec77f5
Parents:
d8613d2
Message:

test removal

File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/java/test/junit/net/i2p/util/CachedIteratorArrayListTest.java

    rd8613d2 rf238d05  
    1212
    1313    private List<Character> l;
     14    private Iterator<Character> iter;
    1415   
    1516    @Before
     
    1920        l.add('b');
    2021        l.add('c');
     22        iter = l.iterator();
    2123    }
    2224   
     
    3638        // and one partial
    3739        total = "";
    38         Iterator<Character> iter = l.iterator();
     40        iter = l.iterator();
    3941        total += iter.next();
    4042        total += iter.next();
     
    5052        assertSame(one, two);
    5153    }
     54   
     55    @Test
     56    public void testRemove() {
     57        iter.next();
     58        iter.remove();
    5259
     60        // test proper removal
     61        assertEquals(2,l.size());
     62        assertEquals('b',l.get(0).charValue());
     63        assertEquals('c',l.get(1).charValue());
     64       
     65        // test iterator still workx after removal
     66        assertTrue(iter.hasNext());
     67        assertEquals('b',iter.next().charValue());
     68        assertEquals('c',iter.next().charValue());
     69        assertFalse(iter.hasNext());
     70    }
    5371}
Note: See TracChangeset for help on using the changeset viewer.