use of org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap in project geode by apache.
the class ConcurrentHashMapJUnitTest method testKeySetToArray.
/**
* keySet.toArray returns contains all keys
*/
@Test
public void testKeySetToArray() {
CustomEntryConcurrentHashMap 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 org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap in project geode by apache.
the class ConcurrentHashMapJUnitTest method testGet_NullPointerException.
/**
* get(null) throws NPE
*/
@Test
public void testGet_NullPointerException() {
try {
CustomEntryConcurrentHashMap c = new CustomEntryConcurrentHashMap(5);
c.get(null);
shouldThrow();
} catch (NullPointerException e) {
}
}
use of org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap in project geode by apache.
the class ConcurrentHashMapJUnitTest method testReplaceValue.
/**
* replace value fails when the given key not mapped to expected value
*/
@Test
public void testReplaceValue() {
CustomEntryConcurrentHashMap map = map5();
assertEquals("A", map.get(one));
assertFalse(map.replace(one, "Z", "Z"));
assertEquals("A", map.get(one));
}
use of org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap in project geode by apache.
the class ConcurrentHashMapJUnitTest method testToString.
/**
* toString contains toString of elements
*/
@Test
public void testToString() {
CustomEntryConcurrentHashMap map = map5();
String s = map.toString();
for (int i = 1; i <= 5; ++i) {
assertTrue(s.indexOf(String.valueOf(i)) >= 0);
}
}
use of org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap in project geode by apache.
the class ConcurrentHashMapJUnitTest method testReplaceValue3_NullPointerException.
/**
* replace(x, y, null) throws NPE
*/
@Test
public void testReplaceValue3_NullPointerException() {
try {
CustomEntryConcurrentHashMap c = new CustomEntryConcurrentHashMap(5);
c.replace("whatever", one, null);
shouldThrow();
} catch (NullPointerException e) {
}
}
Aggregations