use of java.util.ArrayDeque in project mapdb by jankotek.
the class ArrayDequeTest method testOfferLast.
/**
* offerLast(x) succeeds
*/
public void testOfferLast() {
ArrayDeque q = new ArrayDeque();
assertTrue(q.offerLast(zero));
assertTrue(q.offerLast(one));
assertSame(zero, q.peekFirst());
assertSame(one, q.peekLast());
}
use of java.util.ArrayDeque in project mapdb by jankotek.
the class ArrayDequeTest method testAddNull.
/**
* add(null) throws NPE
*/
public void testAddNull() {
ArrayDeque q = new ArrayDeque();
try {
q.add(null);
shouldThrow();
} catch (NullPointerException success) {
}
}
use of java.util.ArrayDeque in project mapdb by jankotek.
the class ArrayDequeTest method testPoll.
/**
* poll() succeeds unless empty
*/
public void testPoll() {
ArrayDeque q = populatedDeque(SIZE);
for (int i = 0; i < SIZE; ++i) {
assertEquals(i, q.poll());
}
assertNull(q.poll());
}
use of java.util.ArrayDeque in project mapdb by jankotek.
the class ArrayDequeTest method testContains.
/**
* contains(x) reports true when elements added but not yet removed
*/
public void testContains() {
ArrayDeque q = populatedDeque(SIZE);
for (int i = 0; i < SIZE; ++i) {
assertTrue(q.contains(new Integer(i)));
assertEquals(i, q.pollFirst());
assertFalse(q.contains(new Integer(i)));
}
}
use of java.util.ArrayDeque in project mapdb by jankotek.
the class ArrayDequeTest method testContainsAll.
/**
* containsAll(c) is true when c contains a subset of elements
*/
public void testContainsAll() {
ArrayDeque q = populatedDeque(SIZE);
ArrayDeque p = new ArrayDeque();
for (int i = 0; i < SIZE; ++i) {
assertTrue(q.containsAll(p));
assertFalse(p.containsAll(q));
assertTrue(p.add(new Integer(i)));
}
assertTrue(p.containsAll(q));
}
Aggregations