use of java.util.ArrayDeque in project mapdb by jankotek.
the class ArrayDequeTest method testOfferFirst.
/**
* offerFirst(x) succeeds
*/
public void testOfferFirst() {
ArrayDeque q = new ArrayDeque();
assertTrue(q.offerFirst(zero));
assertTrue(q.offerFirst(one));
assertSame(one, q.peekFirst());
assertSame(zero, q.peekLast());
}
use of java.util.ArrayDeque in project mapdb by jankotek.
the class ArrayDequeTest method testPush.
/**
* peekFirst() returns element inserted with push
*/
public void testPush() {
ArrayDeque q = populatedDeque(3);
q.pollLast();
q.push(four);
assertSame(four, q.peekFirst());
}
use of java.util.ArrayDeque in project mapdb by jankotek.
the class ArrayDequeTest method testPeek.
/**
* peek() returns next element, or null if empty
*/
public void testPeek() {
ArrayDeque q = populatedDeque(SIZE);
for (int i = 0; i < SIZE; ++i) {
assertEquals(i, q.peek());
assertEquals(i, q.poll());
assertTrue(q.peek() == null || !q.peek().equals(i));
}
assertNull(q.peek());
}
use of java.util.ArrayDeque in project mapdb by jankotek.
the class ArrayDequeTest method testToArray_NullArg.
/**
* toArray(null) throws NullPointerException
*/
public void testToArray_NullArg() {
ArrayDeque l = new ArrayDeque();
l.add(new Object());
try {
l.toArray(null);
shouldThrow();
} catch (NullPointerException success) {
}
}
use of java.util.ArrayDeque in project mapdb by jankotek.
the class ArrayDequeTest method testAddAll2.
/**
* addAll of a collection with null elements throws NPE
*/
public void testAddAll2() {
ArrayDeque q = new ArrayDeque();
try {
q.addAll(Arrays.asList(new Integer[SIZE]));
shouldThrow();
} catch (NullPointerException success) {
}
}
Aggregations