use of java.util.NavigableMap in project mapdb by jankotek.
the class TreeSubMapTest method testSize.
/**
* size returns the correct values
*/
public void testSize() {
NavigableMap map = map5();
NavigableMap empty = map0();
assertEquals(0, empty.size());
assertEquals(5, map.size());
}
use of java.util.NavigableMap in project mapdb by jankotek.
the class TreeSubMapTest method testDescendingPut1_NullPointerException.
/**
* put(null,x) throws NPE
*/
public void testDescendingPut1_NullPointerException() {
NavigableMap c = dmap5();
try {
c.put(null, "whatever");
shouldThrow();
} catch (NullPointerException success) {
}
}
use of java.util.NavigableMap in project mapdb by jankotek.
the class TreeMapTest method testHeadMapContents.
/**
* headMap returns map with keys in requested range
*/
public void testHeadMapContents() {
TreeMap map = map5();
NavigableMap sm = map.headMap(four, false);
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());
sm.clear();
assertTrue(sm.isEmpty());
assertEquals(2, map.size());
assertEquals(four, map.firstKey());
}
use of java.util.NavigableMap in project mapdb by jankotek.
the class TreeSubMapTest method testDescendingHigherEntry.
/**
* higherEntry returns next entry.
*/
public void testDescendingHigherEntry() {
NavigableMap map = dmap5();
Map.Entry e1 = map.higherEntry(m3);
assertEquals(m4, e1.getKey());
Map.Entry e2 = map.higherEntry(zero);
assertEquals(m1, e2.getKey());
Map.Entry e3 = map.higherEntry(m5);
assertNull(e3);
Map.Entry e4 = map.higherEntry(m6);
assertNull(e4);
}
use of java.util.NavigableMap in project mapdb by jankotek.
the class TreeSubMapTest method testPutAll.
/**
* putAll adds all key-value pairs from the given map
*/
public void testPutAll() {
NavigableMap empty = map0();
NavigableMap map = map5();
empty.putAll(map);
assertEquals(5, empty.size());
assertTrue(empty.containsKey(one));
assertTrue(empty.containsKey(two));
assertTrue(empty.containsKey(three));
assertTrue(empty.containsKey(four));
assertTrue(empty.containsKey(five));
}
Aggregations