use of org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap in project geode by apache.
the class ConcurrentHashMapJUnitTest method testValuesToArray.
/**
* Values.toArray contains all values
*/
@Test
public void testValuesToArray() {
CustomEntryConcurrentHashMap map = map5();
Collection v = map.values();
Object[] ar = v.toArray();
ArrayList s = new ArrayList(Arrays.asList(ar));
assertEquals(5, ar.length);
assertTrue(s.contains("A"));
assertTrue(s.contains("B"));
assertTrue(s.contains("C"));
assertTrue(s.contains("D"));
assertTrue(s.contains("E"));
}
use of org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap in project geode by apache.
the class ConcurrentHashMapJUnitTest method testRemove3.
/**
* remove(x, null) returns false
*/
@Test
public void testRemove3() {
try {
CustomEntryConcurrentHashMap c = new CustomEntryConcurrentHashMap(5);
c.put("sadsdf", "asdads");
assertFalse(c.remove("sadsdf", null));
} catch (NullPointerException e) {
fail();
}
}
use of org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap in project geode by apache.
the class ConcurrentHashMapJUnitTest method testContainsKey_NullPointerException.
/**
* containsKey(null) throws NPE
*/
@Test
public void testContainsKey_NullPointerException() {
try {
CustomEntryConcurrentHashMap c = new CustomEntryConcurrentHashMap(5);
c.containsKey(null);
shouldThrow();
} catch (NullPointerException e) {
}
}
use of org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap in project geode by apache.
the class ConcurrentHashMapJUnitTest method testContainsValue.
/**
* containsValue returns true for held values
*/
@Test
public void testContainsValue() {
CustomEntryConcurrentHashMap map = map5();
assertTrue(map.containsValue("A"));
assertFalse(map.containsValue("Z"));
}
use of org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap in project geode by apache.
the class ConcurrentHashMapJUnitTest method testPutAll.
/**
* putAll adds all key-value pairs from the given map
*/
@Test
public void testPutAll() {
CustomEntryConcurrentHashMap empty = new CustomEntryConcurrentHashMap();
CustomEntryConcurrentHashMap 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