21 |
|
|
22 |
|
public class TreeSetTest extends JSR166TestCase { |
23 |
|
public static void main(String[] args) { |
24 |
< |
junit.textui.TestRunner.run(suite()); |
24 |
> |
main(suite(), args); |
25 |
|
} |
26 |
|
public static Test suite() { |
27 |
|
return new TestSuite(TreeSetTest.class); |
91 |
|
*/ |
92 |
|
public void testConstructor4() { |
93 |
|
try { |
94 |
< |
Integer[] ints = new Integer[SIZE]; |
95 |
< |
new TreeSet(Arrays.asList(ints)); |
94 |
> |
new TreeSet(Arrays.asList(new Integer[SIZE])); |
95 |
|
shouldThrow(); |
96 |
|
} catch (NullPointerException success) {} |
97 |
|
} |
100 |
|
* Initializing from Collection with some null elements throws NPE |
101 |
|
*/ |
102 |
|
public void testConstructor5() { |
103 |
+ |
Integer[] ints = new Integer[SIZE]; |
104 |
+ |
for (int i = 0; i < SIZE-1; ++i) |
105 |
+ |
ints[i] = new Integer(i); |
106 |
|
try { |
105 |
– |
Integer[] ints = new Integer[SIZE]; |
106 |
– |
for (int i = 0; i < SIZE-1; ++i) |
107 |
– |
ints[i] = new Integer(i); |
107 |
|
new TreeSet(Arrays.asList(ints)); |
108 |
|
shouldThrow(); |
109 |
|
} catch (NullPointerException success) {} |
169 |
|
* add(null) throws NPE if nonempty |
170 |
|
*/ |
171 |
|
public void testAddNull() { |
172 |
+ |
TreeSet q = populatedSet(SIZE); |
173 |
|
try { |
174 |
– |
TreeSet q = populatedSet(SIZE); |
174 |
|
q.add(null); |
175 |
|
shouldThrow(); |
176 |
|
} catch (NullPointerException success) {} |
198 |
|
* Add of non-Comparable throws CCE |
199 |
|
*/ |
200 |
|
public void testAddNonComparable() { |
201 |
+ |
TreeSet q = new TreeSet(); |
202 |
|
try { |
203 |
– |
TreeSet q = new TreeSet(); |
204 |
– |
q.add(new Object()); |
203 |
|
q.add(new Object()); |
204 |
|
q.add(new Object()); |
205 |
|
shouldThrow(); |
210 |
|
* addAll(null) throws NPE |
211 |
|
*/ |
212 |
|
public void testAddAll1() { |
213 |
+ |
TreeSet q = new TreeSet(); |
214 |
|
try { |
216 |
– |
TreeSet q = new TreeSet(); |
215 |
|
q.addAll(null); |
216 |
|
shouldThrow(); |
217 |
|
} catch (NullPointerException success) {} |
221 |
|
* addAll of a collection with null elements throws NPE |
222 |
|
*/ |
223 |
|
public void testAddAll2() { |
224 |
+ |
TreeSet q = new TreeSet(); |
225 |
+ |
Integer[] ints = new Integer[SIZE]; |
226 |
|
try { |
227 |
– |
TreeSet q = new TreeSet(); |
228 |
– |
Integer[] ints = new Integer[SIZE]; |
227 |
|
q.addAll(Arrays.asList(ints)); |
228 |
|
shouldThrow(); |
229 |
|
} catch (NullPointerException success) {} |
234 |
|
* possibly adding some elements |
235 |
|
*/ |
236 |
|
public void testAddAll3() { |
237 |
+ |
TreeSet q = new TreeSet(); |
238 |
+ |
Integer[] ints = new Integer[SIZE]; |
239 |
+ |
for (int i = 0; i < SIZE-1; ++i) |
240 |
+ |
ints[i] = new Integer(i); |
241 |
|
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); |
242 |
|
q.addAll(Arrays.asList(ints)); |
243 |
|
shouldThrow(); |
244 |
|
} catch (NullPointerException success) {} |