use of java.util.concurrent.ConcurrentMap in project mapdb by jankotek.
the class ConcurrentHashMapV8Test method testRemove2.
/**
* remove(key,value) removes only if pair present
*/
public void testRemove2() {
ConcurrentMap map = map5();
map.remove(five, "E");
assertEquals(4, map.size());
assertFalse(map.containsKey(five));
map.remove(four, "A");
assertEquals(4, map.size());
assertTrue(map.containsKey(four));
}
use of java.util.concurrent.ConcurrentMap in project mapdb by jankotek.
the class ConcurrentHashMapV8Test method testKeySetToArray.
/**
* keySet.toArray returns contains all keys
*/
public void testKeySetToArray() {
ConcurrentMap map = map5();
Set s = map.keySet();
Object[] ar = s.toArray();
assertTrue(s.containsAll(Arrays.asList(ar)));
assertEquals(5, ar.length);
ar[0] = m10;
assertFalse(s.containsAll(Arrays.asList(ar)));
}
use of java.util.concurrent.ConcurrentMap in project mapdb by jankotek.
the class ConcurrentHashMapV8Test method testPut2_NullPointerException.
/**
* put(x, null) throws NPE
*/
public void testPut2_NullPointerException() {
try {
ConcurrentMap c = newMap(5);
c.put("whatever", null);
shouldThrow();
} catch (NullPointerException success) {
}
}
use of java.util.concurrent.ConcurrentMap in project mapdb by jankotek.
the class ConcurrentHashMapV8Test method testPutAll.
/**
* putAll adds all key-value pairs from the given map
*/
public void testPutAll() {
ConcurrentMap empty = newMap();
ConcurrentMap 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.ConcurrentMap in project mapdb by jankotek.
the class ConcurrentHashMapV8Test method testGet.
/**
* get returns the correct element at the given key,
* or null if not present
*/
public void testGet() {
ConcurrentMap map = map5();
assertEquals("A", (String) map.get(one));
ConcurrentMap empty = newMap();
assertNull(map.get("anything"));
}
Aggregations