17 |
|
|
18 |
|
public class LinkedListTest extends JSR166TestCase { |
19 |
|
public static void main(String[] args) { |
20 |
< |
junit.textui.TestRunner.run(suite()); |
20 |
> |
main(suite(), args); |
21 |
|
} |
22 |
|
|
23 |
|
public static Test suite() { |
50 |
|
*/ |
51 |
|
public void testConstructor3() { |
52 |
|
try { |
53 |
< |
LinkedList q = new LinkedList((Collection)null); |
53 |
> |
new LinkedList((Collection)null); |
54 |
|
shouldThrow(); |
55 |
|
} catch (NullPointerException success) {} |
56 |
|
} |
102 |
|
public void testOfferNull() { |
103 |
|
LinkedList q = new LinkedList(); |
104 |
|
q.offer(null); |
105 |
+ |
assertNull(q.get(0)); |
106 |
+ |
assertTrue(q.contains(null)); |
107 |
|
} |
108 |
|
|
109 |
|
/** |
130 |
|
* addAll(null) throws NPE |
131 |
|
*/ |
132 |
|
public void testAddAll1() { |
133 |
+ |
LinkedList q = new LinkedList(); |
134 |
|
try { |
132 |
– |
LinkedList q = new LinkedList(); |
135 |
|
q.addAll(null); |
136 |
|
shouldThrow(); |
137 |
|
} catch (NullPointerException success) {} |
381 |
|
*/ |
382 |
|
public void testIterator() { |
383 |
|
LinkedList q = populatedQueue(SIZE); |
382 |
– |
int i = 0; |
384 |
|
Iterator it = q.iterator(); |
385 |
< |
while (it.hasNext()) { |
385 |
> |
int i; |
386 |
> |
for (i = 0; it.hasNext(); i++) |
387 |
|
assertTrue(q.contains(it.next())); |
386 |
– |
++i; |
387 |
– |
} |
388 |
|
assertEquals(i, SIZE); |
389 |
+ |
assertIteratorExhausted(it); |
390 |
+ |
} |
391 |
+ |
|
392 |
+ |
/** |
393 |
+ |
* iterator of empty collection has no elements |
394 |
+ |
*/ |
395 |
+ |
public void testEmptyIterator() { |
396 |
+ |
assertIteratorExhausted(new LinkedList().iterator()); |
397 |
|
} |
398 |
|
|
399 |
|
/** |