use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListSubMapTest method testDescendingPutIfAbsent1_NullPointerException.
/**
* putIfAbsent(null, x) throws NPE
*/
@Test
public void testDescendingPutIfAbsent1_NullPointerException() {
try {
ConcurrentNavigableMap c = dmap5();
c.putIfAbsent(null, "whatever");
shouldThrow();
} catch (NullPointerException success) {
}
}
use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListSubMapTest method testDescendingValues.
/**
* values collection contains all values
*/
@Test
public void testDescendingValues() {
ConcurrentNavigableMap map = dmap5();
Collection s = map.values();
assertEquals(5, s.size());
assertTrue(s.contains("A"));
assertTrue(s.contains("B"));
assertTrue(s.contains("C"));
assertTrue(s.contains("D"));
assertTrue(s.contains("E"));
}
use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListSubMapTest method map5.
/**
* Returns a new map from Integers 1-5 to Strings "A"-"E".
*/
protected ConcurrentNavigableMap map5() {
ConcurrentNavigableMap map = emptyMap();
assertTrue(map.isEmpty());
map.put(zero, "Z");
map.put(one, "A");
map.put(five, "E");
map.put(three, "C");
map.put(two, "B");
map.put(four, "D");
map.put(seven, "F");
assertFalse(map.isEmpty());
assertEquals(7, map.size());
return map.subMap(one, true, seven, false);
}
use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListSubMapTest method testDescendingPutIfAbsent.
/**
* putIfAbsent works when the given key is not present
*/
@Test
public void testDescendingPutIfAbsent() {
if (isReadOnly())
return;
ConcurrentNavigableMap map = dmap5();
map.putIfAbsent(six, "Z");
assertTrue(map.containsKey(six));
}
use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListSubMapTest method testToString.
/**
* toString contains toString of elements
*/
@Test
public void testToString() {
ConcurrentNavigableMap map = map5();
String s = map.toString();
for (int i = 1; i <= 5; ++i) {
assertTrue(s.contains(String.valueOf(i)));
}
}
Aggregations