9 |
|
import java.util.Deque; |
10 |
|
import java.util.NoSuchElementException; |
11 |
|
import java.util.Queue; |
12 |
+ |
import java.util.function.Consumer; |
13 |
|
|
14 |
|
import junit.framework.Test; |
15 |
|
|
46 |
|
Object[] a = new Object[0]; |
47 |
|
assertSame(a, c.toArray(a)); |
48 |
|
} |
49 |
< |
c.forEach((e) -> { throw new AssertionError(); }); |
49 |
> |
Consumer alwaysThrows = (e) -> { throw new AssertionError(); }; |
50 |
> |
c.forEach(alwaysThrows); |
51 |
> |
c.iterator().forEachRemaining(alwaysThrows); |
52 |
> |
c.spliterator().forEachRemaining(alwaysThrows); |
53 |
> |
assertFalse(c.spliterator().tryAdvance(alwaysThrows)); |
54 |
|
if (Queue.class.isAssignableFrom(impl.klazz())) { |
55 |
|
Queue q = (Queue) c; |
56 |
|
assertNull(q.peek()); |
102 |
|
|
103 |
|
public void testNoSuchElementExceptions() { |
104 |
|
Collection c = impl.emptyCollection(); |
105 |
+ |
assertThrows( |
106 |
+ |
NoSuchElementException.class, |
107 |
+ |
() -> c.iterator().next()); |
108 |
|
|
109 |
|
if (Queue.class.isAssignableFrom(impl.klazz())) { |
110 |
|
Queue q = (Queue) c; |