ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/CollectionTest.java
(Generate patch)

Comparing jsr166/src/test/tck/CollectionTest.java (file contents):
Revision 1.7 by jsr166, Mon Oct 17 20:45:31 2016 UTC vs.
Revision 1.8 by jsr166, Sun Oct 23 22:11:25 2016 UTC

# Line 45 | Line 45 | public class CollectionTest extends JSR1
45          assertTrue(c.isEmpty());
46          assertEquals(0, c.size());
47          assertEquals("[]", c.toString());
48 <        assertEquals(0, c.toArray().length);
48 >        {
49 >            Object[] a = c.toArray();
50 >            assertEquals(0, a.length);
51 >            assertSame(Object[].class, a.getClass());
52 >        }
53          {
54              Object[] a = new Object[0];
55              assertSame(a, c.toArray(a));
56          }
57 +        {
58 +            Integer[] a = new Integer[0];
59 +            assertSame(a, c.toArray(a));
60 +        }
61 +        {
62 +            Integer[] a = { 1, 2, 3};
63 +            assertSame(a, c.toArray(a));
64 +            assertNull(a[0]);
65 +            assertSame(2, a[1]);
66 +            assertSame(3, a[2]);
67 +        }
68          assertIteratorExhausted(c.iterator());
69          Consumer alwaysThrows = (e) -> { throw new AssertionError(); };
70          c.forEach(alwaysThrows);
# Line 79 | Line 94 | public class CollectionTest extends JSR1
94              () -> c.containsAll(null),
95              () -> c.retainAll(null),
96              () -> c.removeAll(null),
97 <            () -> c.removeIf(null));
97 >            () -> c.removeIf(null),
98 >            () -> c.toArray(null));
99  
100          if (!impl.permitsNulls()) {
101              assertThrows(

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines