Package org.apache.commons.collections.primitives

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


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

    public void testWrapUnmodifiableByteListIterator() {
        ByteListIterator iter = makeUnmodifiableByteListIterator();
        assertSame(iter,UnmodifiableByteListIterator.wrap(iter));
    }
View Full Code Here


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

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

            // expected
        }
    }

    public final void testIterateByteListIterator() {       
        ByteListIterator iter = makeUnmodifiableByteListIterator();
        ByteListIterator expected = makeByteListIterator();
       
        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.ByteListIterator

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.