use of java.util.NoSuchElementException in project j2objc by google.
the class ConcurrentLinkedQueueTest method testElement.
/**
* element returns next element, or throws NSEE if empty
*/
public void testElement() {
ConcurrentLinkedQueue q = populatedQueue(SIZE);
for (int i = 0; i < SIZE; ++i) {
assertEquals(i, q.element());
assertEquals(i, q.poll());
}
try {
q.element();
shouldThrow();
} catch (NoSuchElementException success) {
}
}
use of java.util.NoSuchElementException in project j2objc by google.
the class ConcurrentLinkedQueueTest method testRemove.
/**
* remove removes next element, or throws NSEE if empty
*/
public void testRemove() {
ConcurrentLinkedQueue q = populatedQueue(SIZE);
for (int i = 0; i < SIZE; ++i) {
assertEquals(i, q.remove());
}
try {
q.remove();
shouldThrow();
} catch (NoSuchElementException success) {
}
}
use of java.util.NoSuchElementException in project j2objc by google.
the class ConcurrentLinkedDequeTest method testPop.
/**
* pop() removes first element, or throws NSEE if empty
*/
public void testPop() {
ConcurrentLinkedDeque q = populatedDeque(SIZE);
for (int i = 0; i < SIZE; ++i) {
assertEquals(i, q.pop());
}
try {
q.pop();
shouldThrow();
} catch (NoSuchElementException success) {
}
}
use of java.util.NoSuchElementException in project j2objc by google.
the class ConcurrentLinkedDequeTest method testDescendingIterator.
/**
* Descending iterator iterates through all elements
*/
public void testDescendingIterator() {
ConcurrentLinkedDeque q = populatedDeque(SIZE);
int i = 0;
Iterator it = q.descendingIterator();
while (it.hasNext()) {
assertTrue(q.contains(it.next()));
++i;
}
assertEquals(i, SIZE);
assertFalse(it.hasNext());
try {
it.next();
shouldThrow();
} catch (NoSuchElementException success) {
}
}
use of java.util.NoSuchElementException 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());
}
Aggregations