Package net.openhft.collections

Examples of net.openhft.collections.SharedHashMap.replace()


     * replace fails when the given key is not present
     */
    @Test
    public void testReplace() throws IOException {
        SharedHashMap map = map5();
        assertNull(map.replace(six, "Z"));
        assertFalse(map.containsKey(six));
    }

    /**
     * replace succeeds if the key is already present
View Full Code Here


     * replace succeeds if the key is already present
     */
    @Test
    public void testReplace2() throws IOException {
        SharedHashMap map = map5();
        assertNotNull(map.replace(one, "Z"));
        assertEquals("Z", map.get(one));
    }

    /**
     * replace value fails when the given key not mapped to expected value
View Full Code Here

     */
    @Test
    public void testReplaceValue() throws IOException {
        SharedHashMap map = map5();
        assertEquals("A", map.get(one));
        assertFalse(map.replace(one, "Z", "Z"));
        assertEquals("A", map.get(one));
    }

    /**
     * replace value succeeds when the given key mapped to expected value
View Full Code Here

     */
    @Test
    public void testReplaceValue2() throws IOException {
        SharedHashMap map = map5();
        assertEquals("A", map.get(one));
        assertTrue(map.replace(one, "A", "Z"));
        assertEquals("Z", map.get(one));
    }

    /**
     * remove removes the correct key-value pair from the map
View Full Code Here

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

View Full Code Here

     */
    @Test
    public void testReplaceValue_NullPointerException() throws IOException {
        try {
            SharedHashMap c = newShmIntString(5);
            c.replace(null, "A", "whatever");
            shouldThrow();
        } catch (NullPointerException success) {
        }
    }

View Full Code Here

     */
    @Test
    public void testReplace2_NullPointerException() throws IOException {
        try {
            SharedHashMap c = newShmIntString(5);
            c.replace(notPresent, null);
            shouldThrow();
        } catch (NullPointerException success) {
        }
    }

View Full Code Here

     */
    @Test
    public void testReplaceValue2_NullPointerException() throws IOException {
        try {
            SharedHashMap c = newShmIntString(5);
            c.replace(notPresent, null, "A");
            shouldThrow();
        } catch (NullPointerException success) {
        }
    }

View Full Code Here

     */
    @Test
    public void testReplaceValue3_NullPointerException() throws IOException {
        try {
            SharedHashMap c = newShmIntString(5);
            c.replace(notPresent, "A", null);
            shouldThrow();
        } catch (NullPointerException success) {
        }
    }

View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.