199 |
|
q.add(new Object()); |
200 |
|
q.add(new Object()); |
201 |
|
shouldThrow(); |
202 |
< |
} catch (ClassCastException success) {} |
202 |
> |
} catch (ClassCastException success) { |
203 |
> |
assertTrue(q.size() < 2); |
204 |
> |
for (int i = 0, size = q.size(); i < size; i++) |
205 |
> |
assertTrue(q.pollFirst().getClass() == Object.class); |
206 |
> |
assertNull(q.pollFirst()); |
207 |
> |
assertTrue(q.isEmpty()); |
208 |
> |
assertEquals(0, q.size()); |
209 |
> |
} |
210 |
|
} |
211 |
|
|
212 |
|
/** |
698 |
|
} |
699 |
|
|
700 |
|
static NavigableSet<Integer> newSet(Class cl) throws Exception { |
701 |
< |
NavigableSet<Integer> result = (NavigableSet<Integer>) cl.newInstance(); |
701 |
> |
NavigableSet<Integer> result = |
702 |
> |
(NavigableSet<Integer>) cl.getConstructor().newInstance(); |
703 |
|
assertEquals(0, result.size()); |
704 |
|
assertFalse(result.iterator().hasNext()); |
705 |
|
return result; |