59 |
|
*/ |
60 |
|
public void testConstructor2() { |
61 |
|
try { |
62 |
< |
PriorityQueue q = new PriorityQueue(0); |
62 |
> |
new PriorityQueue(0); |
63 |
|
shouldThrow(); |
64 |
|
} catch (IllegalArgumentException success) {} |
65 |
|
} |
69 |
|
*/ |
70 |
|
public void testConstructor3() { |
71 |
|
try { |
72 |
< |
PriorityQueue q = new PriorityQueue((Collection)null); |
72 |
> |
new PriorityQueue((Collection)null); |
73 |
|
shouldThrow(); |
74 |
|
} catch (NullPointerException success) {} |
75 |
|
} |
80 |
|
public void testConstructor4() { |
81 |
|
try { |
82 |
|
Integer[] ints = new Integer[SIZE]; |
83 |
< |
PriorityQueue q = new PriorityQueue(Arrays.asList(ints)); |
83 |
> |
new PriorityQueue(Arrays.asList(ints)); |
84 |
|
shouldThrow(); |
85 |
|
} catch (NullPointerException success) {} |
86 |
|
} |
93 |
|
Integer[] ints = new Integer[SIZE]; |
94 |
|
for (int i = 0; i < SIZE-1; ++i) |
95 |
|
ints[i] = new Integer(i); |
96 |
< |
PriorityQueue q = new PriorityQueue(Arrays.asList(ints)); |
96 |
> |
new PriorityQueue(Arrays.asList(ints)); |
97 |
|
shouldThrow(); |
98 |
|
} catch (NullPointerException success) {} |
99 |
|
} |
189 |
|
* Offer of non-Comparable throws CCE |
190 |
|
*/ |
191 |
|
public void testOfferNonComparable() { |
192 |
+ |
PriorityQueue q = new PriorityQueue(1); |
193 |
|
try { |
193 |
– |
PriorityQueue q = new PriorityQueue(1); |
194 |
– |
q.offer(new Object()); |
194 |
|
q.offer(new Object()); |
195 |
|
q.offer(new Object()); |
196 |
|
shouldThrow(); |
440 |
|
*/ |
441 |
|
public void testIterator() { |
442 |
|
PriorityQueue q = populatedQueue(SIZE); |
444 |
– |
int i = 0; |
443 |
|
Iterator it = q.iterator(); |
444 |
< |
while (it.hasNext()) { |
444 |
> |
int i; |
445 |
> |
for (i = 0; it.hasNext(); i++) |
446 |
|
assertTrue(q.contains(it.next())); |
448 |
– |
++i; |
449 |
– |
} |
447 |
|
assertEquals(i, SIZE); |
448 |
+ |
assertIteratorExhausted(it); |
449 |
+ |
} |
450 |
+ |
|
451 |
+ |
/** |
452 |
+ |
* iterator of empty collection has no elements |
453 |
+ |
*/ |
454 |
+ |
public void testEmptyIterator() { |
455 |
+ |
assertIteratorExhausted(new PriorityQueue().iterator()); |
456 |
|
} |
457 |
|
|
458 |
|
/** |