170 |
|
* add(null) throws NPE if nonempty |
171 |
|
*/ |
172 |
|
public void testAddNull() { |
173 |
+ |
TreeSet q = populatedSet(SIZE); |
174 |
|
try { |
174 |
– |
TreeSet q = populatedSet(SIZE); |
175 |
|
q.add(null); |
176 |
|
shouldThrow(); |
177 |
|
} catch (NullPointerException success) {} |
199 |
|
* Add of non-Comparable throws CCE |
200 |
|
*/ |
201 |
|
public void testAddNonComparable() { |
202 |
+ |
TreeSet q = new TreeSet(); |
203 |
|
try { |
203 |
– |
TreeSet q = new TreeSet(); |
204 |
|
q.add(new Object()); |
205 |
|
q.add(new Object()); |
206 |
|
q.add(new Object()); |
212 |
|
* addAll(null) throws NPE |
213 |
|
*/ |
214 |
|
public void testAddAll1() { |
215 |
+ |
TreeSet q = new TreeSet(); |
216 |
|
try { |
216 |
– |
TreeSet q = new TreeSet(); |
217 |
|
q.addAll(null); |
218 |
|
shouldThrow(); |
219 |
|
} catch (NullPointerException success) {} |
223 |
|
* addAll of a collection with null elements throws NPE |
224 |
|
*/ |
225 |
|
public void testAddAll2() { |
226 |
+ |
TreeSet q = new TreeSet(); |
227 |
+ |
Integer[] ints = new Integer[SIZE]; |
228 |
|
try { |
227 |
– |
TreeSet q = new TreeSet(); |
228 |
– |
Integer[] ints = new Integer[SIZE]; |
229 |
|
q.addAll(Arrays.asList(ints)); |
230 |
|
shouldThrow(); |
231 |
|
} catch (NullPointerException success) {} |
236 |
|
* possibly adding some elements |
237 |
|
*/ |
238 |
|
public void testAddAll3() { |
239 |
+ |
TreeSet q = new TreeSet(); |
240 |
+ |
Integer[] ints = new Integer[SIZE]; |
241 |
+ |
for (int i = 0; i < SIZE-1; ++i) |
242 |
+ |
ints[i] = new Integer(i); |
243 |
|
try { |
240 |
– |
TreeSet q = new TreeSet(); |
241 |
– |
Integer[] ints = new Integer[SIZE]; |
242 |
– |
for (int i = 0; i < SIZE-1; ++i) |
243 |
– |
ints[i] = new Integer(i); |
244 |
|
q.addAll(Arrays.asList(ints)); |
245 |
|
shouldThrow(); |
246 |
|
} catch (NullPointerException success) {} |