400 |
|
public void testRemoveAfterForEachRemaining() { |
401 |
|
Collection c = impl.emptyCollection(); |
402 |
|
ThreadLocalRandom rnd = ThreadLocalRandom.current(); |
403 |
< |
{ |
403 |
> |
testCollection: { |
404 |
|
int n = 3 + rnd.nextInt(2); |
405 |
|
for (int i = 0; i < n; i++) c.add(impl.makeElement(i)); |
406 |
|
Iterator it = c.iterator(); |
413 |
|
if (c instanceof java.util.concurrent.ArrayBlockingQueue) { |
414 |
|
assertIteratorExhausted(it); |
415 |
|
} else { |
416 |
< |
it.remove(); |
416 |
> |
try { it.remove(); } |
417 |
> |
catch (UnsupportedOperationException ok) { |
418 |
> |
break testCollection; |
419 |
> |
} |
420 |
|
assertEquals(n - 1, c.size()); |
421 |
|
for (int i = 0; i < n - 1; i++) |
422 |
|
assertTrue(c.contains(impl.makeElement(i))); |