use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListMapTest method testPutAll.
/**
* putAll adds all key-value pairs from the given map
*/
@Test
public void testPutAll() {
ConcurrentNavigableMap empty = emptyMap();
ConcurrentNavigableMap map = map5();
empty.putAll(map);
assertEquals(5, empty.size());
assertTrue(empty.containsKey(one));
assertTrue(empty.containsKey(two));
assertTrue(empty.containsKey(three));
assertTrue(empty.containsKey(four));
assertTrue(empty.containsKey(five));
}
use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListMapTest method testHigherEntry.
/**
* higherEntry returns next entry.
*/
@Test
public void testHigherEntry() {
ConcurrentNavigableMap map = map5();
Map.Entry e1 = map.higherEntry(three);
assertEquals(four, e1.getKey());
Map.Entry e2 = map.higherEntry(zero);
assertEquals(one, e2.getKey());
Map.Entry e3 = map.higherEntry(five);
assertNull(e3);
Map.Entry e4 = map.higherEntry(six);
assertNull(e4);
}
use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListMapTest method testEntrySetToArray.
/**
* entrySet.toArray contains all entries
*/
@Test
public void testEntrySetToArray() {
ConcurrentNavigableMap map = map5();
Set s = map.entrySet();
Object[] ar = s.toArray();
assertEquals(5, ar.length);
for (int i = 0; i < 5; ++i) {
assertTrue(map.containsKey(((Map.Entry) (ar[i])).getKey()));
assertTrue(map.containsValue(((Map.Entry) (ar[i])).getValue()));
}
}
use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListMapTest method testPut1_NullPointerException.
/**
* put(null,x) throws NPE
*/
@Test
public void testPut1_NullPointerException() {
ConcurrentNavigableMap c = map5();
try {
c.put(null, "whatever");
shouldThrow();
} catch (NullPointerException success) {
}
}
use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListMapTest method testReplace_NullPointerException.
/**
* replace(null, x) throws NPE
*/
@Test
public void testReplace_NullPointerException() {
ConcurrentNavigableMap c = map5();
try {
c.replace(null, "whatever");
shouldThrow();
} catch (NullPointerException success) {
}
}
Aggregations