use of java.util.concurrent.ConcurrentLinkedDeque in project j2objc by google.
the class ConcurrentLinkedDequeTest method testPush.
/**
* peekFirst() returns element inserted with push
*/
public void testPush() {
ConcurrentLinkedDeque q = populatedDeque(3);
q.pollLast();
q.push(four);
assertSame(four, q.peekFirst());
}
use of java.util.concurrent.ConcurrentLinkedDeque in project j2objc by google.
the class ConcurrentLinkedDequeTest method testOfferLastNull.
/**
* offerLast(null) throws NPE
*/
public void testOfferLastNull() {
ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
try {
q.offerLast(null);
shouldThrow();
} catch (NullPointerException success) {
}
}
use of java.util.concurrent.ConcurrentLinkedDeque in project j2objc by google.
the class ConcurrentLinkedDequeTest method testToArray_NullArg.
/**
* toArray(null) throws NullPointerException
*/
public void testToArray_NullArg() {
ConcurrentLinkedDeque q = populatedDeque(SIZE);
try {
q.toArray(null);
shouldThrow();
} catch (NullPointerException success) {
}
}
use of java.util.concurrent.ConcurrentLinkedDeque in project j2objc by google.
the class ConcurrentLinkedDequeTest method testAddNull.
/**
* add(null) throws NPE
*/
public void testAddNull() {
ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
try {
q.add(null);
shouldThrow();
} catch (NullPointerException success) {
}
}
use of java.util.concurrent.ConcurrentLinkedDeque in project j2objc by google.
the class ConcurrentLinkedDequeTest method testIteratorRemove.
/**
* iterator.remove() removes current element
*/
public void testIteratorRemove() {
final ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
final Random rng = new Random();
for (int iters = 0; iters < 100; ++iters) {
int max = rng.nextInt(5) + 2;
int split = rng.nextInt(max - 1) + 1;
for (int j = 1; j <= max; ++j) q.add(new Integer(j));
Iterator it = q.iterator();
for (int j = 1; j <= split; ++j) assertEquals(it.next(), new Integer(j));
it.remove();
assertEquals(it.next(), new Integer(split + 1));
for (int j = 1; j <= split; ++j) q.remove(new Integer(j));
it = q.iterator();
for (int j = split + 1; j <= max; ++j) {
assertEquals(it.next(), new Integer(j));
it.remove();
}
assertFalse(it.hasNext());
assertTrue(q.isEmpty());
}
}
Aggregations