use of java.util.ArrayDeque in project mapdb by jankotek.
the class ArrayDequeTest method testRemove.
/**
* remove() removes next element, or throws NSEE if empty
*/
public void testRemove() {
ArrayDeque q = populatedDeque(SIZE);
for (int i = 0; i < SIZE; ++i) {
assertEquals(i, q.remove());
}
try {
q.remove();
shouldThrow();
} catch (NoSuchElementException success) {
}
}
use of java.util.ArrayDeque in project mapdb by jankotek.
the class ArrayDequeTest method testAddLast.
/**
* addLast(x) succeeds
*/
public void testAddLast() {
ArrayDeque q = new ArrayDeque();
q.addLast(zero);
q.addLast(one);
assertSame(zero, q.peekFirst());
assertSame(one, q.peekLast());
}
use of java.util.ArrayDeque in project mapdb by jankotek.
the class ArrayDequeTest method testOfferNull.
/**
* offer(null) throws NPE
*/
public void testOfferNull() {
ArrayDeque q = new ArrayDeque();
try {
q.offer(null);
shouldThrow();
} catch (NullPointerException success) {
}
}
use of java.util.ArrayDeque in project mapdb by jankotek.
the class ArrayDequeTest method testDescendingIteratorOrdering.
/**
* Descending iterator ordering is reverse FIFO
*/
public void testDescendingIteratorOrdering() {
final ArrayDeque q = new ArrayDeque();
for (int iters = 0; iters < 100; ++iters) {
q.add(new Integer(3));
q.add(new Integer(2));
q.add(new Integer(1));
int k = 0;
for (Iterator it = q.descendingIterator(); it.hasNext(); ) {
assertEquals(++k, it.next());
}
assertEquals(3, k);
q.remove();
q.remove();
q.remove();
}
}
use of java.util.ArrayDeque in project mapdb by jankotek.
the class ArrayDequeTest method testOfferFirstNull.
/**
* offerFirst(null) throws NPE
*/
public void testOfferFirstNull() {
ArrayDeque q = new ArrayDeque();
try {
q.offerFirst(null);
shouldThrow();
} catch (NullPointerException success) {
}
}
Aggregations