Package java.util.concurrent

Examples of java.util.concurrent.ConcurrentNavigableMap.replace()


     * replace(null, x) throws NPE
     */
    public void testReplace_NullPointerException() {
        try {
            ConcurrentNavigableMap c = map5();
            c.replace(null, "whatever");
            shouldThrow();
        } catch (NullPointerException success) {}
    }

    /**
 
View Full Code Here


     * replace(null, x, y) throws NPE
     */
    public void testReplaceValue_NullPointerException() {
        try {
            ConcurrentNavigableMap c = map5();
            c.replace(null, one, "whatever");
            shouldThrow();
        } catch (NullPointerException success) {}
    }

    /**
 
View Full Code Here

    /**
     *   replace fails when the given key is not present
     */
    public void testDescendingReplace() {
        ConcurrentNavigableMap map = dmap5();
        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
     */
    public void testDescendingReplace2() {
        ConcurrentNavigableMap map = dmap5();
        assertNotNull(map.replace(m1, "Z"));
        assertEquals("Z", map.get(m1));
    }


    /**
 
View Full Code Here

     * replace value fails when the given key not mapped to expected value
     */
    public void testDescendingReplaceValue() {
        ConcurrentNavigableMap map = dmap5();
        assertEquals("A", map.get(m1));
        assertFalse(map.replace(m1, "Z", "Z"));
        assertEquals("A", map.get(m1));
    }

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

     * replace value succeeds when the given key mapped to expected value
     */
    public void testDescendingReplaceValue2() {
        ConcurrentNavigableMap map = dmap5();
        assertEquals("A", map.get(m1));
        assertTrue(map.replace(m1, "A", "Z"));
        assertEquals("Z", map.get(m1));
    }


    /**
 
View Full Code Here

    /**
     *   replace fails when the given key is not present
     */
    public void testReplace() {
        ConcurrentNavigableMap 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
     */
    public void testReplace2() {
        ConcurrentNavigableMap map = map5();
        assertNotNull(map.replace(one, "Z"));
        assertEquals("Z", map.get(one));
    }


    /**
 
View Full Code Here

     * replace value fails when the given key not mapped to expected value
     */
    public void testReplaceValue() {
        ConcurrentNavigableMap 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

     * replace value succeeds when the given key mapped to expected value
     */
    public void testReplaceValue2() {
        ConcurrentNavigableMap map = map5();
        assertEquals("A", map.get(one));
        assertTrue(map.replace(one, "A", "Z"));
        assertEquals("Z", map.get(one));
    }


    /**
 
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.