15 |
|
|
16 |
|
public class AbstractQueueTest extends JSR166TestCase { |
17 |
|
public static void main(String[] args) { |
18 |
< |
junit.textui.TestRunner.run (suite()); |
18 |
> |
junit.textui.TestRunner.run(suite()); |
19 |
|
} |
20 |
|
public static Test suite() { |
21 |
|
return new TestSuite(AbstractQueueTest.class); |
59 |
|
try { |
60 |
|
q.add(one); |
61 |
|
shouldThrow(); |
62 |
< |
} catch (IllegalStateException success) { |
63 |
< |
} |
62 |
> |
} catch (IllegalStateException success) {} |
63 |
|
} |
64 |
|
|
65 |
|
/** |
70 |
|
try { |
71 |
|
q.add(null); |
72 |
|
shouldThrow(); |
73 |
< |
} catch (NullPointerException success) { |
75 |
< |
} |
73 |
> |
} catch (NullPointerException success) {} |
74 |
|
} |
75 |
|
|
76 |
|
/** |
89 |
|
try { |
90 |
|
q.remove(); |
91 |
|
shouldThrow(); |
92 |
< |
} catch (NoSuchElementException success) { |
95 |
< |
} |
92 |
> |
} catch (NoSuchElementException success) {} |
93 |
|
} |
94 |
|
|
95 |
|
|
109 |
|
try { |
110 |
|
q.element(); |
111 |
|
shouldThrow(); |
112 |
< |
} catch (NoSuchElementException success) { |
116 |
< |
} |
112 |
> |
} catch (NoSuchElementException success) {} |
113 |
|
} |
114 |
|
|
115 |
|
/** |
120 |
|
Succeed q = new Succeed(); |
121 |
|
q.addAll(null); |
122 |
|
shouldThrow(); |
123 |
< |
} |
128 |
< |
catch (NullPointerException success) {} |
123 |
> |
} catch (NullPointerException success) {} |
124 |
|
} |
125 |
|
|
126 |
|
/** |
131 |
|
Succeed q = new Succeed(); |
132 |
|
q.addAll(q); |
133 |
|
shouldThrow(); |
134 |
< |
} |
140 |
< |
catch (IllegalArgumentException success) {} |
134 |
> |
} catch (IllegalArgumentException success) {} |
135 |
|
} |
136 |
|
|
137 |
|
|
144 |
|
Integer[] ints = new Integer[SIZE]; |
145 |
|
q.addAll(Arrays.asList(ints)); |
146 |
|
shouldThrow(); |
147 |
< |
} |
154 |
< |
catch (NullPointerException success) {} |
147 |
> |
} catch (NullPointerException success) {} |
148 |
|
} |
149 |
+ |
|
150 |
|
/** |
151 |
|
* addAll of a collection with any null elements throws NPE after |
152 |
|
* possibly adding some elements |
159 |
|
ints[i] = new Integer(i); |
160 |
|
q.addAll(Arrays.asList(ints)); |
161 |
|
shouldThrow(); |
162 |
< |
} |
169 |
< |
catch (NullPointerException success) {} |
162 |
> |
} catch (NullPointerException success) {} |
163 |
|
} |
164 |
+ |
|
165 |
|
/** |
166 |
|
* addAll throws ISE if an add fails |
167 |
|
*/ |
173 |
|
ints[i] = new Integer(i); |
174 |
|
q.addAll(Arrays.asList(ints)); |
175 |
|
shouldThrow(); |
176 |
< |
} |
183 |
< |
catch (IllegalStateException success) {} |
176 |
> |
} catch (IllegalStateException success) {} |
177 |
|
} |
178 |
|
|
179 |
|
} |