use of java.util.concurrent.LinkedBlockingDeque in project mapdb by jankotek.
the class LinkedBlockingDequeTest method testOfferLastNull.
/**
* offerLast(null) throws NullPointerException
*/
public void testOfferLastNull() {
LinkedBlockingDeque q = new LinkedBlockingDeque();
try {
q.offerLast(null);
shouldThrow();
} catch (NullPointerException success) {
}
}
use of java.util.concurrent.LinkedBlockingDeque in project mapdb by jankotek.
the class LinkedBlockingDequeTest method testPoll.
/**
* poll succeeds unless empty
*/
public void testPoll() {
LinkedBlockingDeque q = populatedDeque(SIZE);
for (int i = 0; i < SIZE; ++i) {
assertEquals(i, q.poll());
}
assertNull(q.poll());
}
use of java.util.concurrent.LinkedBlockingDeque in project mapdb by jankotek.
the class LinkedBlockingDequeTest method testClear.
/**
* clear removes all elements
*/
public void testClear() {
LinkedBlockingDeque q = populatedDeque(SIZE);
q.clear();
assertTrue(q.isEmpty());
assertEquals(0, q.size());
assertEquals(SIZE, q.remainingCapacity());
q.add(one);
assertFalse(q.isEmpty());
assertTrue(q.contains(one));
q.clear();
assertTrue(q.isEmpty());
}
use of java.util.concurrent.LinkedBlockingDeque in project mapdb by jankotek.
the class LinkedBlockingDequeTest method testOfferFirstNull.
/**
* offerFirst(null) throws NullPointerException
*/
public void testOfferFirstNull() {
LinkedBlockingDeque q = new LinkedBlockingDeque();
try {
q.offerFirst(null);
shouldThrow();
} catch (NullPointerException success) {
}
}
use of java.util.concurrent.LinkedBlockingDeque in project mapdb by jankotek.
the class LinkedBlockingDequeTest method testConstructor6.
/**
* Deque contains all elements of collection used to initialize
*/
public void testConstructor6() {
Integer[] ints = new Integer[SIZE];
for (int i = 0; i < SIZE; ++i) ints[i] = i;
LinkedBlockingDeque q = new LinkedBlockingDeque(Arrays.asList(ints));
for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.poll());
}
Aggregations