Search in sources :

Example 31 with ConcurrentMap

use of java.util.concurrent.ConcurrentMap in project mapdb by jankotek.

the class ConcurrentHashMapTest method testReplaceValue_NullPointerException.

/**
     * replace(null, x, y) throws NPE
     */
@Test
public void testReplaceValue_NullPointerException() {
    ConcurrentMap c = makeMap();
    try {
        c.replace(null, one, "whatever");
        shouldThrow();
    } catch (NullPointerException success) {
    }
}
Also used : ConcurrentMap(java.util.concurrent.ConcurrentMap) Test(org.junit.Test)

Example 32 with ConcurrentMap

use of java.util.concurrent.ConcurrentMap in project mapdb by jankotek.

the class ConcurrentHashMapTest method testRemove3.

/**
     * remove(x, null) returns false
     */
@Test(expected = NullPointerException.class)
public void testRemove3() {
    ConcurrentMap c = makeGenericMap();
    c.put("sadsdf", "asdads");
    c.remove("sadsdf", null);
}
Also used : ConcurrentMap(java.util.concurrent.ConcurrentMap) Test(org.junit.Test)

Example 33 with ConcurrentMap

use of java.util.concurrent.ConcurrentMap in project mapdb by jankotek.

the class ConcurrentHashMapTest method testContainsKey.

/**
     * containsKey returns true for contained key
     */
@Test
public void testContainsKey() {
    ConcurrentMap map = map5();
    assertTrue(map.containsKey(one));
    assertFalse(map.containsKey(zero));
}
Also used : ConcurrentMap(java.util.concurrent.ConcurrentMap) Test(org.junit.Test)

Example 34 with ConcurrentMap

use of java.util.concurrent.ConcurrentMap in project mapdb by jankotek.

the class ConcurrentHashMapV8Test 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));
}
Also used : ConcurrentMap(java.util.concurrent.ConcurrentMap)

Example 35 with ConcurrentMap

use of java.util.concurrent.ConcurrentMap in project mapdb by jankotek.

the class ConcurrentHashMapV8Test method testContainsKey_NullPointerException.

/**
     * containsKey(null) throws NPE
     */
public void testContainsKey_NullPointerException() {
    try {
        ConcurrentMap c = newMap(5);
        c.containsKey(null);
        shouldThrow();
    } catch (NullPointerException success) {
    }
}
Also used : ConcurrentMap(java.util.concurrent.ConcurrentMap)

Aggregations

ConcurrentMap (java.util.concurrent.ConcurrentMap)450 Map (java.util.Map)125 Test (org.junit.Test)111 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)83 HashMap (java.util.HashMap)75 ArrayList (java.util.ArrayList)58 Set (java.util.Set)41 URL (com.alibaba.dubbo.common.URL)32 List (java.util.List)26 Collectors (java.util.stream.Collectors)22 IOException (java.io.IOException)21 HashSet (java.util.HashSet)21 Collection (java.util.Collection)19 UsageCount (org.apache.felix.framework.ServiceRegistry.UsageCount)19 Bundle (org.osgi.framework.Bundle)19 CountDownLatch (java.util.concurrent.CountDownLatch)18 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)16 Arrays (java.util.Arrays)15 Field (java.lang.reflect.Field)14 Iterator (java.util.Iterator)13