Package com.hazelcast.core

Examples of com.hazelcast.core.ISet


    //    ======================== isEmpty test ============================

    @Test
    public void testIsEmpty_whenEmpty() {
        ISet set = newSet();
        assertTrue(set.isEmpty());
    }
View Full Code Here


        assertTrue(set.isEmpty());
    }

    @Test
    public void testIsEmpty_whenNotEmpty() {
        ISet set = newSet();
        set.add("item1");
        assertFalse(set.isEmpty());
    }
View Full Code Here

    //    ======================== add - addAll test =======================

    @Test
    public void testAdd() {
        ISet set = newSet();
        for (int i = 1; i <= 10; i++) {
            assertTrue(set.add("item" + i));
        }
        assertEquals(10, set.size());
    }
View Full Code Here

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

    @Test
    public void testAdd_withMaxCapacity() {
        ISet set = newSetWithMaxSize(1);
        set.add("item");
        for (int i = 1; i <= 10; i++) {
            assertFalse(set.add("item" + i));
        }
        assertEquals(1, set.size());
    }
View Full Code Here

        assertEquals(1, set.size());
    }

    @Test(expected = NullPointerException.class)
    public void testAddNull() {
        ISet set = newSet();
        set.add(null);
    }
View Full Code Here

    }

    @Test
    public void testAddAll_Basic() {
        Set added = new HashSet();
        ISet set = newSet();
        added.add("item1");
        added.add("item2");
        set.addAll(added);
        assertEquals(2, set.size());
    }
View Full Code Here

    }

    @Test
    public void testAddAll_whenAllElementsSame() {
        Set added = new HashSet();
        ISet set = newSet();
        for (int i = 1; i <= 10; i++) {
            added.add("item");
        }
        set.addAll(added);
        assertEquals(1, set.size());
    }
View Full Code Here

    }

    @Test
    public void testAddAll_whenCollectionContainsNull() {
        Set added = new HashSet();
        ISet set = newSet();
        added.add("item1");
        added.add(null);
        try {
            assertFalse(set.addAll(added));
        } catch (NullPointerException e) {
        }
        assertEquals(0, set.size());
    }
View Full Code Here

    //    ======================== remove  - removeAll ==========================


    @Test
    public void testRemoveBasic() {
        ISet set = newSet();
        set.add("item1");
        assertTrue(set.remove("item1"));
        assertEquals(0, set.size());
    }
View Full Code Here

        assertEquals(0, set.size());
    }

    @Test
    public void testRemove_whenElementNotExist() {
        ISet set = newSet();
        set.add("item1");
        assertFalse(set.remove("notExist"));
        assertEquals(1, set.size());
    }
View Full Code Here

TOP

Related Classes of com.hazelcast.core.ISet

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.