20 |
|
|
21 |
|
public class CopyOnWriteArraySetTest extends JSR166TestCase { |
22 |
|
public static void main(String[] args) { |
23 |
< |
junit.textui.TestRunner.run(suite()); |
23 |
> |
main(suite(), args); |
24 |
|
} |
25 |
|
public static Test suite() { |
26 |
|
return new TestSuite(CopyOnWriteArraySetTest.class); |
59 |
|
*/ |
60 |
|
public void testConstructor3() { |
61 |
|
Integer[] ints = new Integer[SIZE]; |
62 |
< |
for (int i = 0; i < SIZE-1; ++i) |
62 |
> |
for (int i = 0; i < SIZE - 1; ++i) |
63 |
|
ints[i] = new Integer(i); |
64 |
|
CopyOnWriteArraySet a = new CopyOnWriteArraySet(Arrays.asList(ints)); |
65 |
|
for (int i = 0; i < SIZE; ++i) |
284 |
|
a = new Integer[0]; |
285 |
|
assertSame(a, empty.toArray(a)); |
286 |
|
|
287 |
< |
a = new Integer[SIZE/2]; |
287 |
> |
a = new Integer[SIZE / 2]; |
288 |
|
Arrays.fill(a, 42); |
289 |
|
assertSame(a, empty.toArray(a)); |
290 |
|
assertNull(a[0]); |
308 |
|
assertSame(a, full.toArray(a)); |
309 |
|
assertTrue(Arrays.equals(elements, a)); |
310 |
|
|
311 |
< |
a = new Integer[2*SIZE]; |
311 |
> |
a = new Integer[2 * SIZE]; |
312 |
|
Arrays.fill(a, 42); |
313 |
|
assertSame(a, full.toArray(a)); |
314 |
|
assertTrue(Arrays.equals(elements, Arrays.copyOf(a, SIZE))); |
322 |
|
* not store the objects inside the set |
323 |
|
*/ |
324 |
|
public void testToArray_ArrayStoreException() { |
325 |
+ |
CopyOnWriteArraySet c = new CopyOnWriteArraySet(); |
326 |
+ |
c.add("zfasdfsdf"); |
327 |
+ |
c.add("asdadasd"); |
328 |
|
try { |
326 |
– |
CopyOnWriteArraySet c = new CopyOnWriteArraySet(); |
327 |
– |
c.add("zfasdfsdf"); |
328 |
– |
c.add("asdadasd"); |
329 |
|
c.toArray(new Long[5]); |
330 |
|
shouldThrow(); |
331 |
|
} catch (ArrayStoreException success) {} |