use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListSubMapTest method testDescendingValuesToArray.
/**
* Values.toArray contains all values
*/
@Test
public void testDescendingValuesToArray() {
ConcurrentNavigableMap map = dmap5();
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 java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListSubMapTest method testPutIfAbsent2.
/**
* putIfAbsent does not add the pair if the key is already present
*/
@Test
public void testPutIfAbsent2() {
if (isReadOnly())
return;
ConcurrentNavigableMap map = map5();
assertEquals("A", map.putIfAbsent(one, "Z"));
}
use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListSubMapTest method testDescendingPutAll.
/**
* putAll adds all key-value pairs from the given map
*/
@Test
public void testDescendingPutAll() {
if (isReadOnly())
return;
ConcurrentNavigableMap empty = dmap0();
ConcurrentNavigableMap map = dmap5();
empty.putAll(map);
assertEquals(5, empty.size());
assertTrue(empty.containsKey(m1));
assertTrue(empty.containsKey(m2));
assertTrue(empty.containsKey(m3));
assertTrue(empty.containsKey(m4));
assertTrue(empty.containsKey(m5));
}
use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListSubMapTest method testDescendingReplace.
/**
* replace fails when the given key is not present
*/
@Test
public void testDescendingReplace() {
if (isReadOnly())
return;
ConcurrentNavigableMap map = dmap5();
assertNull(map.replace(six, "Z"));
assertFalse(map.containsKey(six));
}
use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListSubMapTest method testIsEmpty.
/**
* isEmpty is true of empty map and false for non-empty
*/
@Test
public void testIsEmpty() {
ConcurrentNavigableMap empty = map0();
ConcurrentNavigableMap map = map5();
assertTrue(empty.isEmpty());
assertFalse(map.isEmpty());
}
Aggregations