use of java.util.concurrent.ConcurrentMap in project caffeine by ben-manes.
the class ConcurrentHashMapTest method testGet_NullPointerException.
// Exception tests
/**
* get(null) throws NPE
*/
public void testGet_NullPointerException() {
ConcurrentMap c = map();
try {
c.get(null);
shouldThrow();
} catch (NullPointerException success) {
}
}
use of java.util.concurrent.ConcurrentMap in project caffeine by ben-manes.
the class ConcurrentHashMapTest method testToString.
/**
* toString contains toString of elements
*/
public void testToString() {
ConcurrentMap map = map5();
String s = map.toString();
for (int i = 1; i <= 5; ++i) {
assertTrue(s.contains(String.valueOf(i)));
}
}
use of java.util.concurrent.ConcurrentMap in project caffeine by ben-manes.
the class ConcurrentHashMapTest method testClear.
/**
* clear removes all pairs
*/
public void testClear() {
ConcurrentMap map = map5();
map.clear();
assertEquals(0, map.size());
}
use of java.util.concurrent.ConcurrentMap in project caffeine by ben-manes.
the class ConcurrentHashMapTest method testPutIfAbsent.
/**
* putIfAbsent works when the given key is not present
*/
public void testPutIfAbsent() {
ConcurrentMap map = map5();
map.putIfAbsent(six, "Z");
assertTrue(map.containsKey(six));
}
use of java.util.concurrent.ConcurrentMap in project caffeine by ben-manes.
the class ConcurrentHashMapTest method testReplaceValue.
/**
* replace value fails when the given key not mapped to expected value
*/
public void testReplaceValue() {
ConcurrentMap map = map5();
assertEquals("A", map.get(one));
assertFalse(map.replace(one, "Z", "Z"));
assertEquals("A", map.get(one));
}
Aggregations