use of org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap in project geode by apache.
the class ConcurrentHashMapJUnitTest method testEntrySetToArray.
/**
* entrySet.toArray contains all entries
*/
@Test
public void testEntrySetToArray() {
CustomEntryConcurrentHashMap map = map5();
Set s = map.entrySet();
Object[] ar = s.toArray();
assertEquals(5, ar.length);
for (int i = 0; i < 5; ++i) {
assertTrue(map.containsKey(((Map.Entry) (ar[i])).getKey()));
assertTrue(map.containsValue(((Map.Entry) (ar[i])).getValue()));
}
}
use of org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap in project geode by apache.
the class ConcurrentHashMapJUnitTest method testContains_NullPointerException.
/**
* contains(null) throws NPE
*/
@Test
public void testContains_NullPointerException() {
try {
CustomEntryConcurrentHashMap c = new CustomEntryConcurrentHashMap(5);
c.contains(null);
shouldThrow();
} catch (NullPointerException e) {
}
}
use of org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap in project geode by apache.
the class ConcurrentHashMapJUnitTest method testReplace2.
/**
* replace succeeds if the key is already present
*/
@Test
public void testReplace2() {
CustomEntryConcurrentHashMap map = map5();
assertNotNull(map.replace(one, "Z"));
assertEquals("Z", map.get(one));
}
use of org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap in project geode by apache.
the class ConcurrentHashMapJUnitTest method testPutIfAbsent2.
/**
* putIfAbsent does not add the pair if the key is already present
*/
@Test
public void testPutIfAbsent2() {
CustomEntryConcurrentHashMap map = map5();
assertEquals("A", map.putIfAbsent(one, "Z"));
}
use of org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap in project geode by apache.
the class ConcurrentHashMapJUnitTest method testKeys.
/**
* keys returns an enumeration containing all the keys from the map
*/
@Test
public void testKeys() {
CustomEntryConcurrentHashMap map = map5();
Enumeration e = map.keys();
int count = 0;
while (e.hasMoreElements()) {
count++;
e.nextElement();
}
assertEquals(5, count);
}
Aggregations