use of java.util.concurrent.ConcurrentLinkedDeque in project j2objc by google.
the class ConcurrentLinkedDequeTest method testAddAll3.
/**
* addAll of a collection with any null elements throws NPE after
* possibly adding some elements
*/
public void testAddAll3() {
ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
Integer[] ints = new Integer[SIZE];
for (int i = 0; i < SIZE - 1; ++i) ints[i] = new Integer(i);
try {
q.addAll(Arrays.asList(ints));
shouldThrow();
} catch (NullPointerException success) {
}
}
use of java.util.concurrent.ConcurrentLinkedDeque in project j2objc by google.
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 j2objc by google.
the class ConcurrentLinkedDequeTest method testAddLastNull.
/**
* addLast(null) throws NPE
*/
public void testAddLastNull() {
ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
try {
q.addLast(null);
shouldThrow();
} catch (NullPointerException success) {
}
}
use of java.util.concurrent.ConcurrentLinkedDeque in project j2objc by google.
the class ConcurrentLinkedDequeTest method testAddLast.
/**
* addLast(x) succeeds
*/
public void testAddLast() {
ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
q.addLast(zero);
q.addLast(one);
assertSame(zero, q.peekFirst());
assertSame(one, q.peekLast());
}
use of java.util.concurrent.ConcurrentLinkedDeque in project j2objc by google.
the class ConcurrentLinkedDequeTest method testContains.
/**
* contains(x) reports true when elements added but not yet removed
*/
public void testContains() {
ConcurrentLinkedDeque q = populatedDeque(SIZE);
for (int i = 0; i < SIZE; ++i) {
assertTrue(q.contains(new Integer(i)));
q.poll();
assertFalse(q.contains(new Integer(i)));
}
}
Aggregations