@Override public boolean replace(long key, long oldValue, long newValue) {
        assert oldValue != nullValue : "replace() called with null-sentinel oldValue " + nullValue;
        assert newValue != nullValue : "replace() called with null-sentinel newValue " + nullValue;
        final long valueAddr = hsa.get(key);
        if (valueAddr == NULL_ADDRESS) {
            return false;
        }
        final long actualValue = mem.getLong(valueAddr);
        if (actualValue != oldValue) {
            return false;
        }
        mem.putLong(valueAddr, newValue);
        return true;
    }
@Test
    public void testReplace() throws Exception {
        long key = newKey();
        long value = newValue();

        assertEqualsKV(MISSING_VALUE, map.replace(key, value), key, value);

        map.put(key, value);

        long newValue = newValue();
        assertEqualsKV(value, map.replace(key, newValue), key, value);
    }