419 |
|
assertTrue(it.hasNext()); |
420 |
|
it.next(); |
421 |
|
} |
422 |
< |
assertFalse(it.hasNext()); |
423 |
< |
try { |
424 |
< |
it.next(); |
425 |
< |
shouldThrow(); |
426 |
< |
} catch (NoSuchElementException success) {} |
422 |
> |
assertIteratorExhausted(it); |
423 |
> |
} |
424 |
> |
|
425 |
> |
/** |
426 |
> |
* iterator of empty collections has no elements |
427 |
> |
*/ |
428 |
> |
public void testEmptyIterator() { |
429 |
> |
assertIteratorExhausted(ConcurrentHashMap.newKeySet().iterator()); |
430 |
> |
assertIteratorExhausted(new ConcurrentHashMap().entrySet().iterator()); |
431 |
> |
assertIteratorExhausted(new ConcurrentHashMap().values().iterator()); |
432 |
> |
assertIteratorExhausted(new ConcurrentHashMap().keySet().iterator()); |
433 |
|
} |
434 |
|
|
435 |
|
/** |