use of java.util.concurrent.ConcurrentLinkedDeque in project j2objc by google.
the class ConcurrentLinkedDequeTest method testPeekFirst.
/**
* peekFirst() returns next element, or null if empty
*/
public void testPeekFirst() {
ConcurrentLinkedDeque q = populatedDeque(SIZE);
for (int i = 0; i < SIZE; ++i) {
assertEquals(i, q.peekFirst());
assertEquals(i, q.pollFirst());
assertTrue(q.peekFirst() == null || !q.peekFirst().equals(i));
}
assertNull(q.peekFirst());
}
use of java.util.concurrent.ConcurrentLinkedDeque in project j2objc by google.
the class ConcurrentLinkedDequeTest method testContainsAll.
/**
* containsAll(c) is true when c contains a subset of elements
*/
public void testContainsAll() {
ConcurrentLinkedDeque q = populatedDeque(SIZE);
ConcurrentLinkedDeque p = new ConcurrentLinkedDeque();
for (int i = 0; i < SIZE; ++i) {
assertTrue(q.containsAll(p));
assertFalse(p.containsAll(q));
p.add(new Integer(i));
}
assertTrue(p.containsAll(q));
}
use of java.util.concurrent.ConcurrentLinkedDeque in project j2objc by google.
the class ConcurrentLinkedDequeTest method testAddFirst.
/**
* addFirst(x) succeeds
*/
public void testAddFirst() {
ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
q.addFirst(zero);
q.addFirst(one);
assertSame(one, q.peekFirst());
assertSame(zero, q.peekLast());
}
use of java.util.concurrent.ConcurrentLinkedDeque in project j2objc by google.
the class ConcurrentLinkedDequeTest method testPushNull.
/**
* push(null) throws NPE
*/
public void testPushNull() {
ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
try {
q.push(null);
shouldThrow();
} catch (NullPointerException success) {
}
}
use of java.util.concurrent.ConcurrentLinkedDeque in project j2objc by google.
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());
}
Aggregations