use of java.util.ArrayDeque in project mapdb by jankotek.
the class ArrayDequeTest method testRemoveFirst.
/**
* removeFirst() removes first element, or throws NSEE if empty
*/
public void testRemoveFirst() {
ArrayDeque q = populatedDeque(SIZE);
for (int i = 0; i < SIZE; ++i) {
assertEquals(i, q.removeFirst());
}
try {
q.removeFirst();
shouldThrow();
} catch (NoSuchElementException success) {
}
assertNull(q.peekFirst());
}
use of java.util.ArrayDeque in project mapdb by jankotek.
the class ArrayDequeTest method testEmptyIterator.
/**
* iterator of empty collection has no elements
*/
public void testEmptyIterator() {
Deque c = new ArrayDeque();
assertIteratorExhausted(c.iterator());
assertIteratorExhausted(c.descendingIterator());
}
use of java.util.ArrayDeque in project mapdb by jankotek.
the class ArrayDequeTest method testClear.
/**
* clear removes all elements
*/
public void testClear() {
ArrayDeque q = populatedDeque(SIZE);
q.clear();
assertTrue(q.isEmpty());
assertEquals(0, q.size());
assertTrue(q.add(new Integer(1)));
assertFalse(q.isEmpty());
q.clear();
assertTrue(q.isEmpty());
}
use of java.util.ArrayDeque in project mapdb by jankotek.
the class ArrayDequeTest method testPollLast.
/**
* pollLast() succeeds unless empty
*/
public void testPollLast() {
ArrayDeque q = populatedDeque(SIZE);
for (int i = SIZE - 1; i >= 0; --i) {
assertEquals(i, q.pollLast());
}
assertNull(q.pollLast());
}
use of java.util.ArrayDeque in project mapdb by jankotek.
the class ArrayDequeTest method testAddLastNull.
/**
* addLast(null) throws NPE
*/
public void testAddLastNull() {
ArrayDeque q = new ArrayDeque();
try {
q.addLast(null);
shouldThrow();
} catch (NullPointerException success) {
}
}
Aggregations