use of java.util.concurrent.ConcurrentMap in project mapdb by jankotek.
the class ConcurrentHashMapV8Test method testRemove.
/**
* remove removes the correct key-value pair from the map
*/
public void testRemove() {
ConcurrentMap map = map5();
map.remove(five);
assertEquals(4, map.size());
assertFalse(map.containsKey(five));
}
use of java.util.concurrent.ConcurrentMap in project mapdb by jankotek.
the class ConcurrentHashMapV8Test method testReplaceValue2_NullPointerException.
/**
* replace(x, null, y) throws NPE
*/
public void testReplaceValue2_NullPointerException() {
try {
ConcurrentMap c = newMap(5);
c.replace("whatever", null, "A");
shouldThrow();
} catch (NullPointerException success) {
}
}
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) {
}
}
Aggregations