use of java.util.concurrent.ConcurrentLinkedDeque in project mapdb by jankotek.
the class ConcurrentLinkedDequeTest method testRemoveFirst.
/**
* removeFirst() removes first element, or throws NSEE if empty
*/
public void testRemoveFirst() {
ConcurrentLinkedDeque 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.concurrent.ConcurrentLinkedDeque in project mapdb by jankotek.
the class ConcurrentLinkedDequeTest method testOfferFirst.
/**
* offerFirst(x) succeeds
*/
public void testOfferFirst() {
ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
assertTrue(q.offerFirst(zero));
assertTrue(q.offerFirst(one));
assertSame(one, q.peekFirst());
assertSame(zero, q.peekLast());
}
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 testRemoveFirstOccurrence.
/**
* removeFirstOccurrence(x) removes x and returns true if present
*/
public void testRemoveFirstOccurrence() {
ConcurrentLinkedDeque q = populatedDeque(SIZE);
for (int i = 1; i < SIZE; i += 2) {
assertTrue(q.removeFirstOccurrence(new Integer(i)));
}
for (int i = 0; i < SIZE; i += 2) {
assertTrue(q.removeFirstOccurrence(new Integer(i)));
assertFalse(q.removeFirstOccurrence(new Integer(i + 1)));
}
assertTrue(q.isEmpty());
}
use of java.util.concurrent.ConcurrentLinkedDeque in project mapdb by jankotek.
the class ConcurrentLinkedDequeTest method testEmptyIterator.
/**
* iterator of empty collection has no elements
*/
public void testEmptyIterator() {
Deque c = new ConcurrentLinkedDeque();
assertIteratorExhausted(c.iterator());
assertIteratorExhausted(c.descendingIterator());
}
Aggregations