Package org.apache.commons.collections.primitives

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


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

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


            // expected
        }
    }

    public final void testIterateLongListIterator() {       
        LongListIterator iter = makeUnmodifiableLongListIterator();
        LongListIterator expected = makeLongListIterator();
       
        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

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

    public void testWrapUnmodifiableLongListIterator() {
        LongListIterator iter = makeUnmodifiableLongListIterator();
        assertSame(iter,UnmodifiableLongListIterator.wrap(iter));
    }
View Full Code Here

TOP

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

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.