60 |
|
} |
61 |
|
|
62 |
|
<T> void testEmptyEnumeration(final Enumeration<T> e) { |
63 |
– |
check(e == emptyEnumeration()); |
63 |
|
check(! e.hasMoreElements()); |
64 |
|
THROWS(NoSuchElementException.class, |
65 |
|
new F(){void f(){ e.nextElement(); }}); |
66 |
|
} |
67 |
|
|
68 |
|
<T> void testEmptyIterator(final Iterator<T> it) { |
70 |
– |
check(it == emptyIterator()); |
69 |
|
check(! it.hasNext()); |
70 |
|
THROWS(NoSuchElementException.class, |
71 |
|
new F(){void f(){ it.next(); }}); |
74 |
|
} |
75 |
|
|
76 |
|
void testEmptyMap(Map<Object, Object> m) { |
79 |
– |
check(m == emptyMap()); |
77 |
|
check(m.entrySet().iterator() == |
78 |
|
Collections.<Map.Entry<Object,Object>>emptyIterator()); |
79 |
|
check(m.values().iterator() == emptyIterator()); |
108 |
|
|
109 |
|
<E> void testEmptyCollection(final Collection<E> c) { |
110 |
|
testEmptyIterator(c.iterator()); |
114 |
– |
|
115 |
– |
check(c.iterator() == emptyIterator()); |
116 |
– |
if (c instanceof List) |
117 |
– |
check(((List<?>)c).listIterator() == emptyListIterator()); |
118 |
– |
|
111 |
|
testToArray(c); |
112 |
|
} |
113 |
|
|