Package com.hazelcast.core

Examples of com.hazelcast.core.IList


//    ======================= RetainAll =======================

    @Test
    public void testRetainAll() {
        IList list = newList_withInitialData(10);

        List listTest = new ArrayList<String>();
        listTest.add("item0");
        listTest.add("item1");
        listTest.add("item2");


        assertTrue(list.retainAll(listTest));
        assertEquals(3, list.size());
        assertIterableEquals(list, "item0", "item1", "item2");
    }
View Full Code Here


        assertIterableEquals(list, "item0", "item1", "item2");
    }

    @Test(expected = NullPointerException.class)
    public void testRetainAll_whenCollectionNull() {
        IList list = newList();
        list.retainAll(null);
    }
View Full Code Here

//    ====================== IsEmpty ==================

    @Test
    public void testIsEmpty_whenEmpty() {
        IList list = newList();
        assertTrue(list.isEmpty());
    }
View Full Code Here

        assertTrue(list.isEmpty());
    }

    @Test
    public void testIsEmpty_whenNotEmpty() {
        IList list = newList_withInitialData(1);
        assertFalse(list.isEmpty());
    }
View Full Code Here

//    =================== Add ===================

    @Test
    public void testAdd() {
        IList list = newList_withInitialData(10);
        assertEquals(10, list.size());
    }
View Full Code Here

        assertEquals(10, list.size());
    }

    @Test
    public void testAdd_whenArgNull() {
        IList list = newList();
        try {
            list.add(null);
            fail();
        } catch (NullPointerException expected) {
        }
        assertTrue(list.isEmpty());
    }
View Full Code Here

        assertTrue(list.isEmpty());
    }

    @Test
    public void testAdd_whenNoCapacity() {
        IList list = newListWithMaxSizeCfg(10);
        for (int i = 0; i < 10; i++) {
            list.add("item" + i);
        }

        boolean added = list.add("item10");
        assertFalse(added);
        assertEquals(10, list.size());
    }
View Full Code Here

        assertEquals(10, list.size());
    }

    @Test
    public void testAddWithIndex() {
        IList list = newList();
        for (int i = 0; i < 10; i++) {
            list.add(i, "item" + i);
        }
        assertEquals(10, list.size());
    }
View Full Code Here

        assertEquals(10, list.size());
    }

    @Test
    public void testAddWithIndex_whenIndexAlreadyTaken() {
        IList list = newList_withInitialData(10);
        assertEquals("item4", list.get(4));
        list.add(4, "test");
        assertEquals("test", list.get(4));
    }
View Full Code Here

        assertEquals("test", list.get(4));
    }

    @Test
    public void testAddWithIndex_whenIndexAlreadyTaken_ArgNull() {
        IList list = newList_withInitialData(10);
        assertEquals("item4", list.get(4));
        try {
            list.add(4, null);
            fail();
        } catch (NullPointerException expected) {
        }
        assertEquals("item4", list.get(4));
    }
View Full Code Here

TOP

Related Classes of com.hazelcast.core.IList

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.