use of java.util.concurrent.SynchronousQueue in project j2objc by google.
the class SynchronousQueueTest method testTimedPoll.
public void testTimedPoll(boolean fair) {
final SynchronousQueue q = new SynchronousQueue(fair);
long startTime = System.nanoTime();
try {
assertNull(q.poll(timeoutMillis(), MILLISECONDS));
} catch (InterruptedException e) {
threadUnexpectedException(e);
}
assertTrue(millisElapsedSince(startTime) >= timeoutMillis());
}
use of java.util.concurrent.SynchronousQueue in project j2objc by google.
the class SynchronousQueueTest method testAdd.
public void testAdd(boolean fair) {
SynchronousQueue q = new SynchronousQueue(fair);
assertEquals(0, q.remainingCapacity());
try {
q.add(one);
shouldThrow();
} catch (IllegalStateException success) {
}
}
use of java.util.concurrent.SynchronousQueue in project j2objc by google.
the class SynchronousQueueTest method testSerialization.
/**
* a deserialized serialized queue is usable
*/
public void testSerialization() {
final SynchronousQueue x = new SynchronousQueue();
final SynchronousQueue y = new SynchronousQueue(false);
final SynchronousQueue z = new SynchronousQueue(true);
assertSerialEquals(x, y);
assertNotSerialEquals(x, z);
SynchronousQueue[] qs = { x, y, z };
for (SynchronousQueue q : qs) {
SynchronousQueue clone = serialClone(q);
assertNotSame(q, clone);
assertSerialEquals(q, clone);
assertTrue(clone.isEmpty());
assertEquals(0, clone.size());
assertEquals(0, clone.remainingCapacity());
assertFalse(clone.offer(zero));
}
}
use of java.util.concurrent.SynchronousQueue in project j2objc by google.
the class SynchronousQueueTest method testToString.
public void testToString(boolean fair) {
final SynchronousQueue q = new SynchronousQueue(fair);
String s = q.toString();
assertNotNull(s);
}
use of java.util.concurrent.SynchronousQueue in project j2objc by google.
the class SynchronousQueueTest method testPoll.
public void testPoll(boolean fair) {
final SynchronousQueue q = new SynchronousQueue(fair);
assertNull(q.poll());
}
Aggregations