use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListSubMapTest method testValues.
/**
* values collection contains all values
*/
@Test
public void testValues() {
ConcurrentNavigableMap map = map5();
Collection s = map.values();
assertEquals(5, s.size());
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 testHeadMapContents.
/**
* headMap returns map with keys in requested range
*/
@Test
public void testHeadMapContents() {
ConcurrentNavigableMap map = map5();
SortedMap sm = map.headMap(four);
assertTrue(sm.containsKey(one));
assertTrue(sm.containsKey(two));
assertTrue(sm.containsKey(three));
assertFalse(sm.containsKey(four));
assertFalse(sm.containsKey(five));
Iterator i = sm.keySet().iterator();
Object k;
k = (Integer) (i.next());
assertEquals(one, k);
k = (Integer) (i.next());
assertEquals(two, k);
k = (Integer) (i.next());
assertEquals(three, k);
assertFalse(i.hasNext());
if (isReadOnly())
return;
sm.clear();
assertTrue(sm.isEmpty());
assertEquals(2, map.size());
assertEquals(four, map.firstKey());
}
use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListSubMapTest method testDescendingContainsValue_NullPointerException.
/**
* containsValue(null) throws NPE
*/
@Test
public void testDescendingContainsValue_NullPointerException() {
try {
ConcurrentNavigableMap c = dmap0();
c.containsValue(null);
shouldThrow();
} catch (NullPointerException success) {
}
}
use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListSubMapTest method testValuesToArray.
/**
* Values.toArray contains all values
*/
@Test
public void testValuesToArray() {
ConcurrentNavigableMap 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 java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.
the class ConcurrentSkipListSubMapTest method testDescendingSize.
/**
* size returns the correct values
*/
@Test
public void testDescendingSize() {
ConcurrentNavigableMap map = dmap5();
ConcurrentNavigableMap empty = dmap0();
assertEquals(0, empty.size());
assertEquals(5, map.size());
}
Aggregations