use of java.util.NavigableSet in project mapdb by jankotek.
the class ConcurrentSkipListSubSetTest method testDescendingSubSetContents.
/**
* subSet returns set with keys in requested range
*/
public void testDescendingSubSetContents() {
NavigableSet set = dset5();
SortedSet sm = set.subSet(m2, m4);
assertEquals(m2, sm.first());
assertEquals(m3, sm.last());
assertEquals(2, sm.size());
assertFalse(sm.contains(m1));
assertTrue(sm.contains(m2));
assertTrue(sm.contains(m3));
assertFalse(sm.contains(m4));
assertFalse(sm.contains(m5));
Iterator i = sm.iterator();
Object k;
k = (Integer) (i.next());
assertEquals(m2, k);
k = (Integer) (i.next());
assertEquals(m3, k);
assertFalse(i.hasNext());
Iterator j = sm.iterator();
j.next();
j.remove();
assertFalse(set.contains(m2));
assertEquals(4, set.size());
assertEquals(1, sm.size());
assertEquals(m3, sm.first());
assertEquals(m3, sm.last());
assertTrue(sm.remove(m3));
assertTrue(sm.isEmpty());
assertEquals(3, set.size());
}
use of java.util.NavigableSet in project mapdb by jankotek.
the class ConcurrentSkipListSubSetTest method testAddAll1.
/**
* addAll(null) throws NPE
*/
public void testAddAll1() {
NavigableSet q = set0();
try {
q.addAll(null);
shouldThrow();
} catch (NullPointerException success) {
}
}
use of java.util.NavigableSet in project mapdb by jankotek.
the class ConcurrentSkipListSubSetTest method testDescendingToString.
/**
* toString contains toStrings of elements
*/
public void testDescendingToString() {
NavigableSet q = populatedSet(SIZE);
String s = q.toString();
for (int i = 0; i < SIZE; ++i) {
assertTrue(s.contains(String.valueOf(i)));
}
}
use of java.util.NavigableSet in project mapdb by jankotek.
the class ConcurrentSkipListSubSetTest method testLower.
/**
* lower returns preceding element
*/
public void testLower() {
NavigableSet q = set5();
Object e1 = q.lower(three);
assertEquals(two, e1);
Object e2 = q.lower(six);
assertEquals(five, e2);
Object e3 = q.lower(one);
assertNull(e3);
Object e4 = q.lower(zero);
assertNull(e4);
}
use of java.util.NavigableSet in project mapdb by jankotek.
the class ConcurrentSkipListSubSetTest method testDescendingClear.
/**
* clear removes all elements
*/
public void testDescendingClear() {
NavigableSet q = populatedSet(SIZE);
q.clear();
assertTrue(q.isEmpty());
assertEquals(0, q.size());
q.add(new Integer(1));
assertFalse(q.isEmpty());
q.clear();
assertTrue(q.isEmpty());
}
Aggregations