Package org.apache.commons.collections.primitives

Examples of org.apache.commons.collections.primitives.ShortListIterator


    public void testWrapNull() {
        assertNull(UnmodifiableShortListIterator.wrap(null));
    }

    public void testWrapUnmodifiableShortListIterator() {
        ShortListIterator iter = makeUnmodifiableShortListIterator();
        assertSame(iter,UnmodifiableShortListIterator.wrap(iter));
    }
View Full Code Here


    // tests
    // ------------------------------------------------------------------------

    public final void testShortListIteratorNotModifiable() {
        ShortListIterator iter = makeUnmodifiableShortListIterator();
        assertTrue(iter.hasNext());
        iter.next();
        try {
            iter.remove();
            fail("Expected UnsupportedOperationException");
        } catch(UnsupportedOperationException e) {
            // expected
        }
        try {
            iter.add((short)1);
            fail("Expected UnsupportedOperationException");
        } catch(UnsupportedOperationException e) {
            // expected
        }
        try {
            iter.set((short)3);
            fail("Expected UnsupportedOperationException");
        } catch(UnsupportedOperationException e) {
            // expected
        }
    }
View Full Code Here

            // expected
        }
    }

    public final void testIterateShortListIterator() {       
        ShortListIterator iter = makeUnmodifiableShortListIterator();
        ShortListIterator expected = makeShortListIterator();
       
        assertTrue(! iter.hasPrevious());
       
        while( expected.hasNext() ) {
            assertTrue(iter.hasNext());
            assertEquals(expected.nextIndex(),iter.nextIndex());
            assertEquals(expected.previousIndex(),iter.previousIndex());
            assertEquals(expected.next(),iter.next());
            assertTrue(iter.hasPrevious());
            assertEquals(expected.nextIndex(),iter.nextIndex());
            assertEquals(expected.previousIndex(),iter.previousIndex());
        }

        assertTrue(! iter.hasNext() );

        while( expected.hasPrevious() ) {
            assertTrue(iter.hasPrevious());
            assertEquals(expected.nextIndex(),iter.nextIndex());
            assertEquals(expected.previousIndex(),iter.previousIndex());
            assertEquals(expected.previous(),iter.previous());
            assertTrue(iter.hasNext());
            assertEquals(expected.nextIndex(),iter.nextIndex());
            assertEquals(expected.previousIndex(),iter.previousIndex());
        }
        assertTrue(! iter.hasPrevious() );
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.collections.primitives.ShortListIterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.