Package edu.stanford.ppl.concurrent

Examples of edu.stanford.ppl.concurrent.SnapTreeMap.replace()


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


    /**
 
View Full Code Here

     * replace(null, x) throws NPE
     */
    public void testReplace_NullPointerException() {
        try {
            SnapTreeMap 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 {
            SnapTreeMap c = map5();
            c.replace(null, one, "whatever");
            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.