18 |
|
|
19 |
|
public class ArrayDequeTest extends JSR166TestCase { |
20 |
|
public static void main(String[] args) { |
21 |
< |
junit.textui.TestRunner.run(suite()); |
21 |
> |
main(suite(), args); |
22 |
|
} |
23 |
|
|
24 |
|
public static Test suite() { |
51 |
|
*/ |
52 |
|
public void testConstructor3() { |
53 |
|
try { |
54 |
< |
ArrayDeque q = new ArrayDeque((Collection)null); |
54 |
> |
new ArrayDeque((Collection)null); |
55 |
|
shouldThrow(); |
56 |
|
} catch (NullPointerException success) {} |
57 |
|
} |
62 |
|
public void testConstructor4() { |
63 |
|
try { |
64 |
|
Integer[] ints = new Integer[SIZE]; |
65 |
< |
ArrayDeque q = new ArrayDeque(Arrays.asList(ints)); |
65 |
> |
new ArrayDeque(Arrays.asList(ints)); |
66 |
|
shouldThrow(); |
67 |
|
} catch (NullPointerException success) {} |
68 |
|
} |
75 |
|
Integer[] ints = new Integer[SIZE]; |
76 |
|
for (int i = 0; i < SIZE-1; ++i) |
77 |
|
ints[i] = new Integer(i); |
78 |
< |
ArrayDeque q = new ArrayDeque(Arrays.asList(ints)); |
78 |
> |
new ArrayDeque(Arrays.asList(ints)); |
79 |
|
shouldThrow(); |
80 |
|
} catch (NullPointerException success) {} |
81 |
|
} |
742 |
|
*/ |
743 |
|
public void testIterator() { |
744 |
|
ArrayDeque q = populatedDeque(SIZE); |
745 |
– |
int i = 0; |
745 |
|
Iterator it = q.iterator(); |
746 |
< |
while (it.hasNext()) { |
746 |
> |
int i; |
747 |
> |
for (i = 0; it.hasNext(); i++) |
748 |
|
assertTrue(q.contains(it.next())); |
749 |
– |
++i; |
750 |
– |
} |
749 |
|
assertEquals(i, SIZE); |
750 |
+ |
assertIteratorExhausted(it); |
751 |
+ |
} |
752 |
+ |
|
753 |
+ |
/** |
754 |
+ |
* iterator of empty collection has no elements |
755 |
+ |
*/ |
756 |
+ |
public void testEmptyIterator() { |
757 |
+ |
Deque c = new ArrayDeque(); |
758 |
+ |
assertIteratorExhausted(c.iterator()); |
759 |
+ |
assertIteratorExhausted(c.descendingIterator()); |
760 |
|
} |
761 |
|
|
762 |
|
/** |