use of java.util.concurrent.ConcurrentLinkedDeque in project mapdb by jankotek.
the class ConcurrentLinkedDequeTest method testPoll.
/**
* poll() succeeds unless empty
*/
public void testPoll() {
ConcurrentLinkedDeque q = populatedDeque(SIZE);
for (int i = 0; i < SIZE; ++i) {
assertEquals(i, q.poll());
}
assertNull(q.poll());
}
use of java.util.concurrent.ConcurrentLinkedDeque in project mapdb by jankotek.
the class ConcurrentLinkedDequeTest method testFirstElement.
/**
* getFirst() returns first element, or throws NSEE if empty
*/
public void testFirstElement() {
ConcurrentLinkedDeque q = populatedDeque(SIZE);
for (int i = 0; i < SIZE; ++i) {
assertEquals(i, q.getFirst());
assertEquals(i, q.pollFirst());
}
try {
q.getFirst();
shouldThrow();
} catch (NoSuchElementException success) {
}
}
use of java.util.concurrent.ConcurrentLinkedDeque in project mapdb by jankotek.
the class ConcurrentLinkedDequeTest method testAddAll1.
/**
* addAll(null) throws NPE
*/
public void testAddAll1() {
ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
try {
q.addAll(null);
shouldThrow();
} catch (NullPointerException success) {
}
}
use of java.util.concurrent.ConcurrentLinkedDeque in project mapdb by jankotek.
the class ConcurrentLinkedDequeTest method testDescendingIterator.
/**
* Descending iterator iterates through all elements
*/
public void testDescendingIterator() {
ConcurrentLinkedDeque q = populatedDeque(SIZE);
int i = 0;
Iterator it = q.descendingIterator();
while (it.hasNext()) {
assertTrue(q.contains(it.next()));
++i;
}
assertEquals(i, SIZE);
assertFalse(it.hasNext());
try {
it.next();
shouldThrow();
} catch (NoSuchElementException success) {
}
}
use of java.util.concurrent.ConcurrentLinkedDeque in project mapdb by jankotek.
the class ConcurrentLinkedDequeTest method testAddFirstNull.
/**
* addFirst(null) throws NPE
*/
public void testAddFirstNull() {
ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
try {
q.addFirst(null);
shouldThrow();
} catch (NullPointerException success) {
}
}
Aggregations