45 |
|
try { |
46 |
|
ArrayDeque q = new ArrayDeque((Collection)null); |
47 |
|
shouldThrow(); |
48 |
< |
} |
49 |
< |
catch (NullPointerException success) {} |
48 |
> |
} catch (NullPointerException success) {} |
49 |
|
} |
50 |
|
|
51 |
|
/** |
53 |
|
|
54 |
|
*/ |
55 |
|
public void testConstructor6() { |
56 |
< |
try { |
57 |
< |
Integer[] ints = new Integer[SIZE]; |
58 |
< |
for (int i = 0; i < SIZE; ++i) |
59 |
< |
ints[i] = new Integer(i); |
60 |
< |
ArrayDeque q = new ArrayDeque(Arrays.asList(ints)); |
61 |
< |
for (int i = 0; i < SIZE; ++i) |
63 |
< |
assertEquals(ints[i], q.pollFirst()); |
64 |
< |
} |
65 |
< |
finally {} |
56 |
> |
Integer[] ints = new Integer[SIZE]; |
57 |
> |
for (int i = 0; i < SIZE; ++i) |
58 |
> |
ints[i] = new Integer(i); |
59 |
> |
ArrayDeque q = new ArrayDeque(Arrays.asList(ints)); |
60 |
> |
for (int i = 0; i < SIZE; ++i) |
61 |
> |
assertEquals(ints[i], q.pollFirst()); |
62 |
|
} |
63 |
|
|
64 |
|
/** |
98 |
|
ArrayDeque q = new ArrayDeque(1); |
99 |
|
q.push(null); |
100 |
|
shouldThrow(); |
101 |
< |
} catch (NullPointerException success) { } |
101 |
> |
} catch (NullPointerException success) {} |
102 |
|
} |
103 |
|
|
104 |
|
/** |
122 |
|
try { |
123 |
|
q.pop(); |
124 |
|
shouldThrow(); |
125 |
< |
} catch (NoSuchElementException success) { |
130 |
< |
} |
125 |
> |
} catch (NoSuchElementException success) {} |
126 |
|
} |
127 |
|
|
128 |
|
/** |
133 |
|
ArrayDeque q = new ArrayDeque(); |
134 |
|
q.offerFirst(null); |
135 |
|
shouldThrow(); |
136 |
< |
} catch (NullPointerException success) { |
142 |
< |
} |
136 |
> |
} catch (NullPointerException success) {} |
137 |
|
} |
138 |
|
|
139 |
|
/** |
173 |
|
ArrayDeque q = new ArrayDeque(); |
174 |
|
q.addAll(null); |
175 |
|
shouldThrow(); |
176 |
< |
} |
183 |
< |
catch (NullPointerException success) {} |
176 |
> |
} catch (NullPointerException success) {} |
177 |
|
} |
178 |
|
|
179 |
|
/** |
180 |
|
* Queue contains all elements, in traversal order, of successful addAll |
181 |
|
*/ |
182 |
|
public void testAddAll5() { |
183 |
< |
try { |
184 |
< |
Integer[] empty = new Integer[0]; |
185 |
< |
Integer[] ints = new Integer[SIZE]; |
186 |
< |
for (int i = 0; i < SIZE; ++i) |
187 |
< |
ints[i] = new Integer(i); |
188 |
< |
ArrayDeque q = new ArrayDeque(); |
189 |
< |
assertFalse(q.addAll(Arrays.asList(empty))); |
190 |
< |
assertTrue(q.addAll(Arrays.asList(ints))); |
191 |
< |
for (int i = 0; i < SIZE; ++i) |
199 |
< |
assertEquals(ints[i], q.pollFirst()); |
200 |
< |
} |
201 |
< |
finally {} |
183 |
> |
Integer[] empty = new Integer[0]; |
184 |
> |
Integer[] ints = new Integer[SIZE]; |
185 |
> |
for (int i = 0; i < SIZE; ++i) |
186 |
> |
ints[i] = new Integer(i); |
187 |
> |
ArrayDeque q = new ArrayDeque(); |
188 |
> |
assertFalse(q.addAll(Arrays.asList(empty))); |
189 |
> |
assertTrue(q.addAll(Arrays.asList(ints))); |
190 |
> |
for (int i = 0; i < SIZE; ++i) |
191 |
> |
assertEquals(ints[i], q.pollFirst()); |
192 |
|
} |
193 |
|
|
194 |
|
/** |
235 |
|
try { |
236 |
|
q.remove(); |
237 |
|
shouldThrow(); |
238 |
< |
} catch (NoSuchElementException success) { |
249 |
< |
} |
238 |
> |
} catch (NoSuchElementException success) {} |
239 |
|
} |
240 |
|
|
241 |
|
/** |
292 |
|
try { |
293 |
|
q.getFirst(); |
294 |
|
shouldThrow(); |
295 |
< |
} |
307 |
< |
catch (NoSuchElementException success) {} |
295 |
> |
} catch (NoSuchElementException success) {} |
296 |
|
} |
297 |
|
|
298 |
|
/** |
307 |
|
try { |
308 |
|
q.getLast(); |
309 |
|
shouldThrow(); |
310 |
< |
} |
323 |
< |
catch (NoSuchElementException success) {} |
310 |
> |
} catch (NoSuchElementException success) {} |
311 |
|
assertNull(q.peekLast()); |
312 |
|
} |
313 |
|
|
323 |
|
try { |
324 |
|
q.removeFirst(); |
325 |
|
shouldThrow(); |
326 |
< |
} catch (NoSuchElementException success) { |
340 |
< |
} |
326 |
> |
} catch (NoSuchElementException success) {} |
327 |
|
} |
328 |
|
|
329 |
|
/** |
475 |
|
l.add(new Integer(5)); |
476 |
|
Object o[] = l.toArray(new String[10] ); |
477 |
|
shouldThrow(); |
478 |
< |
} catch (ArrayStoreException success) {} |
478 |
> |
} catch (ArrayStoreException success) {} |
479 |
|
} |
480 |
|
|
481 |
|
/** |
552 |
|
assertFalse(it.hasNext()); |
553 |
|
try { |
554 |
|
it.next(); |
555 |
< |
} catch (NoSuchElementException success) { |
556 |
< |
} |
555 |
> |
shouldThrow(); |
556 |
> |
} catch (NoSuchElementException success) {} |
557 |
|
} |
558 |
|
|
559 |
|
/** |