use of java.util.concurrent.ConcurrentMap in project caffeine by ben-manes.
the class ConcurrentHashMapTest method testRemove2_NullPointerException.
/**
* remove(null, x) throws NPE
*/
public void testRemove2_NullPointerException() {
ConcurrentMap c = map();
c.put("sadsdf", "asdads");
try {
c.remove(null, "whatever");
shouldThrow();
} catch (NullPointerException success) {
}
}
use of java.util.concurrent.ConcurrentMap in project caffeine by ben-manes.
the class ConcurrentHashMapTest method testRemove1_NullPointerException.
/**
* remove(null) throws NPE
*/
public void testRemove1_NullPointerException() {
ConcurrentMap c = map();
c.put("sadsdf", "asdads");
try {
c.remove(null);
shouldThrow();
} catch (NullPointerException success) {
}
}
use of java.util.concurrent.ConcurrentMap in project caffeine by ben-manes.
the class ConcurrentHashMapTest method testIsEmpty.
/**
* isEmpty is true of empty map and false for non-empty
*/
public void testIsEmpty() {
ConcurrentMap empty = map();
ConcurrentMap map = map5();
assertTrue(empty.isEmpty());
assertFalse(map.isEmpty());
}
use of java.util.concurrent.ConcurrentMap in project caffeine by ben-manes.
the class ConcurrentHashMapTest 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 caffeine by ben-manes.
the class ConcurrentHashMapTest method testPutAll.
/**
* putAll adds all key-value pairs from the given map
*/
public void testPutAll() {
ConcurrentMap empty = map();
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));
}
Aggregations