use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListMapTest method testReplaceValue2.
/**
* replace value succeeds when the given key mapped to expected value
*/
@Test
public void testReplaceValue2() {
ConcurrentNavigableMap map = map5();
assertEquals("A", map.get(one));
assertTrue(map.replace(one, "A", "Z"));
assertEquals("Z", map.get(one));
}
use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListMapTest method testLowerEntry.
/**
* lowerEntry returns preceding entry.
*/
@Test
public void testLowerEntry() {
ConcurrentNavigableMap map = map5();
Map.Entry e1 = map.lowerEntry(three);
assertEquals(two, e1.getKey());
Map.Entry e2 = map.lowerEntry(six);
assertEquals(five, e2.getKey());
Map.Entry e3 = map.lowerEntry(one);
assertNull(e3);
Map.Entry e4 = map.lowerEntry(zero);
assertNull(e4);
}
use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListMapTest method testContainsKey.
/**
* containsKey returns true for contained key
*/
@Test
public void testContainsKey() {
ConcurrentNavigableMap map = map5();
assertTrue(map.containsKey(one));
assertFalse(map.containsKey(zero));
}
use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListMapTest method testPutIfAbsent1_NullPointerException.
/**
* putIfAbsent(null, x) throws NPE
*/
@Test
public void testPutIfAbsent1_NullPointerException() {
ConcurrentNavigableMap c = map5();
try {
c.putIfAbsent(null, "whatever");
shouldThrow();
} catch (NullPointerException success) {
}
}
use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListMapTest method testKeySet.
/**
* keySet returns a Set containing all the keys
*/
@Test
public void testKeySet() {
ConcurrentNavigableMap map = map5();
Set s = map.keySet();
assertEquals(5, s.size());
assertTrue(s.contains(one));
assertTrue(s.contains(two));
assertTrue(s.contains(three));
assertTrue(s.contains(four));
assertTrue(s.contains(five));
}
Aggregations