Package net.openhft.collections

Examples of net.openhft.collections.SharedHashMap


    /**
     * remove removes the correct key-value pair from the map
     */
    @Test
    public void testRemove() throws IOException {
        SharedHashMap map = map5();
        map.remove(five);
        assertEquals(4, map.size());
        assertFalse(map.containsKey(five));
    }
View Full Code Here


    /**
     * remove(key,value) removes only if pair present
     */
    @Test
    public void testRemove2() throws IOException {
        SharedHashMap map = map5();
        map.remove(five, "E");
        assertEquals(4, map.size());
        assertFalse(map.containsKey(five));
        map.remove(four, "A");
        assertEquals(4, map.size());
        assertTrue(map.containsKey(four));
    }
View Full Code Here

    /**
     * size returns the correct values
     */
    @Test
    public void testSize() throws IOException {
        SharedHashMap map = map5();
        SharedHashMap empty = newShmIntString();
        assertEquals(0, empty.size());
        assertEquals(5, map.size());
    }
View Full Code Here

    /**
     * toString contains toString of elements
     */
    @Test
    public void testToString() throws IOException {
        SharedHashMap map = map5();
        String s = map.toString();
        for (int i = 1; i <= 5; ++i) {
            assertTrue(s.contains(String.valueOf(i)));
        }
    }
View Full Code Here

     * get(null) throws NPE
     */
    @Test
    public void testGet_NullPointerException() throws IOException {
        try {
            SharedHashMap c = newShmIntString(5);
            c.get(null);
            shouldThrow();
        } catch (NullPointerException success) {
        }
    }
View Full Code Here

     * containsKey(null) throws NPE
     */
    @Test
    public void testContainsKey_NullPointerException() throws IOException {
        try {
            SharedHashMap c = newShmIntString(5);
            c.containsKey(null);
            shouldThrow();
        } catch (NullPointerException success) {
        }
    }
View Full Code Here

     * put(null,x) throws NPE
     */
    @Test
    public void testPut1_NullPointerException() throws IOException {
        try {
            SharedHashMap c = newShmIntString(5);
            c.put(null, "whatever");
            shouldThrow();
        } catch (NullPointerException success) {
        }
    }
View Full Code Here

     * put(x, null) throws NPE
     */
    @Test
    public void testPut2_NullPointerException() throws IOException {
        try {
            SharedHashMap c = newShmIntString(5);
            c.put(notPresent, null);
            shouldThrow();
        } catch (NullPointerException success) {
        }
    }
View Full Code Here

     * putIfAbsent(null, x) throws NPE
     */
    @Test
    public void testPutIfAbsent1_NullPointerException() throws IOException {
        try {
            SharedHashMap c = newShmIntString(5);
            c.putIfAbsent(null, "whatever");
            shouldThrow();
        } catch (NullPointerException success) {
        }
    }
View Full Code Here

     * replace(null, x) throws NPE
     */
    @Test
    public void testReplace_NullPointerException() throws IOException {
        try {
            SharedHashMap c = newShmIntString(5);
            c.replace(null, "whatever");
            shouldThrow();
        } catch (NullPointerException success) {
        }
    }
View Full Code Here

TOP

Related Classes of net.openhft.collections.SharedHashMap

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.