use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListSubMapTest method testDescendingDescendingKeySetToArray.
/**
* descendingkeySet.toArray returns contains all keys
*/
@Test
public void testDescendingDescendingKeySetToArray() {
ConcurrentNavigableMap map = dmap5();
Set s = map.descendingKeySet();
Object[] ar = s.toArray();
assertEquals(5, ar.length);
assertTrue(s.containsAll(Arrays.asList(ar)));
ar[0] = m10;
assertFalse(s.containsAll(Arrays.asList(ar)));
}
use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListSubMapTest method testDescendingGet.
/**
* get returns the correct element at the given key,
* or null if not present
*/
@Test
public void testDescendingGet() {
ConcurrentNavigableMap map = dmap5();
assertEquals("A", (String) map.get(m1));
ConcurrentNavigableMap empty = dmap0();
assertNull(empty.get(m1));
}
use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListSubMapTest method testReplaceValue_NullPointerException.
/**
* replace(null, x, y) throws NPE
*/
@Test
public void testReplaceValue_NullPointerException() {
try {
ConcurrentNavigableMap c = map5();
c.replace(null, one, "whatever");
shouldThrow();
} catch (NullPointerException success) {
}
}
use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListSubMapTest method testDescendingRemove2_NullPointerException.
/**
* remove(null, x) throws NPE
*/
@Test
public void testDescendingRemove2_NullPointerException() {
if (isReadOnly())
return;
try {
ConcurrentNavigableMap c = dmap5();
c.remove(null, "whatever");
shouldThrow();
} catch (NullPointerException success) {
}
}
use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListSubMapTest method testPollLastEntry.
/**
* pollLastEntry returns entries in order
*/
@Test
public void testPollLastEntry() {
if (isReadOnly())
return;
ConcurrentNavigableMap map = map5();
Map.Entry e = map.pollLastEntry();
assertEquals(five, e.getKey());
assertEquals("E", e.getValue());
e = map.pollLastEntry();
assertEquals(four, e.getKey());
map.put(five, "E");
e = map.pollLastEntry();
assertEquals(five, e.getKey());
assertEquals("E", e.getValue());
e = map.pollLastEntry();
assertEquals(three, e.getKey());
map.remove(two);
e = map.pollLastEntry();
assertEquals(one, e.getKey());
try {
e.setValue("E");
shouldThrow();
} catch (UnsupportedOperationException success) {
}
e = map.pollLastEntry();
assertNull(e);
}
Aggregations