Package org.jgroups.util

Examples of org.jgroups.util.UnmodifiableVector


public class UnmodifiableVectorTest {


    public static void testCreation() {
        Vector v=new Vector(Arrays.asList("one", "two"));
        UnmodifiableVector uv=new UnmodifiableVector(v);
        Assert.assertEquals(v.size(), uv.size());
        assert uv.contains("two");
    }
View Full Code Here


    }

    @Test(expectedExceptions=UnsupportedOperationException.class)
    public static void testAddition() {
        Vector v=new Vector(Arrays.asList("one", "two"));
        UnmodifiableVector uv=new UnmodifiableVector(v);
        uv.add("three");
    }
View Full Code Here

    }

    @Test(expectedExceptions=UnsupportedOperationException.class)
    public static void testRemoval() {
        Vector v=new Vector(Arrays.asList("one", "two"));
        UnmodifiableVector uv=new UnmodifiableVector(v);
        uv.add("two");
    }
View Full Code Here

    }

    @Test(expectedExceptions=UnsupportedOperationException.class)
    public static void testIteration() {
        Vector v=new Vector(Arrays.asList("one", "two"));
        UnmodifiableVector uv=new UnmodifiableVector(v);
        Object el;
        for(Iterator it=uv.iterator(); it.hasNext();) {
            el=it.next();
            System.out.println(el);
        }

        for(Iterator it=uv.iterator(); it.hasNext();) {
            el=it.next();
            it.remove();
        }
    }
View Full Code Here

    }

    @Test(expectedExceptions=UnsupportedOperationException.class)
    public static void testListIteration() {
        Vector v=new Vector(Arrays.asList("one", "two"));
        UnmodifiableVector uv=new UnmodifiableVector(v);
        Object el;
        for(ListIterator it=uv.listIterator(); it.hasNext();) {
            el=it.next();
            System.out.println(el);
        }

        for(ListIterator it=uv.listIterator(); it.hasNext();) {
            el=it.next();
            it.remove();
        }
    }
View Full Code Here

    public void setUp() throws Exception {
        super.setUp();
        v=new Vector();
        v.add("one"); v.add("two");
        uv=new UnmodifiableVector(v);
    }
View Full Code Here

TOP

Related Classes of org.jgroups.util.UnmodifiableVector

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.