use of java.util.concurrent.LinkedTransferQueue in project mapdb by jankotek.
the class LinkedTransferQueueTest method testToArray1_BadArg.
/**
* toArray(incompatible array type) throws ArrayStoreException
*/
public void testToArray1_BadArg() {
LinkedTransferQueue q = populatedQueue(SIZE);
try {
q.toArray(new String[10]);
shouldThrow();
} catch (ArrayStoreException success) {
}
}
use of java.util.concurrent.LinkedTransferQueue in project mapdb by jankotek.
the class LinkedTransferQueueTest method testIteratorRemove.
/**
* iterator.remove() removes current element
*/
public void testIteratorRemove() {
final LinkedTransferQueue q = new LinkedTransferQueue();
q.add(two);
q.add(one);
q.add(three);
Iterator it = q.iterator();
it.next();
it.remove();
it = q.iterator();
assertSame(it.next(), one);
assertSame(it.next(), three);
assertFalse(it.hasNext());
}
use of java.util.concurrent.LinkedTransferQueue in project mapdb by jankotek.
the class LinkedTransferQueueTest method testTransfer1.
/**
* transfer(null) throws NullPointerException
*/
public void testTransfer1() throws InterruptedException {
try {
LinkedTransferQueue q = new LinkedTransferQueue();
q.transfer(null);
shouldThrow();
} catch (NullPointerException success) {
}
}
use of java.util.concurrent.LinkedTransferQueue in project mapdb by jankotek.
the class LinkedTransferQueueTest method testRetainAll.
/**
* retainAll(c) retains only those elements of c and reports true
* if changed
*/
public void testRetainAll() {
LinkedTransferQueue q = populatedQueue(SIZE);
LinkedTransferQueue p = populatedQueue(SIZE);
for (int i = 0; i < SIZE; ++i) {
boolean changed = q.retainAll(p);
if (i == 0) {
assertFalse(changed);
} else {
assertTrue(changed);
}
assertTrue(q.containsAll(p));
assertEquals(SIZE - i, q.size());
p.remove();
}
}
use of java.util.concurrent.LinkedTransferQueue in project mapdb by jankotek.
the class LinkedTransferQueueTest method testTryTransfer1.
/**
* tryTransfer(null) throws NullPointerException
*/
public void testTryTransfer1() {
final LinkedTransferQueue q = new LinkedTransferQueue();
try {
q.tryTransfer(null);
shouldThrow();
} catch (NullPointerException success) {
}
}
Aggregations