--- jsr166/src/test/tck/ArrayListTest.java 2019/11/14 01:43:45 1.7 +++ jsr166/src/test/tck/ArrayListTest.java 2021/01/26 13:33:05 1.8 @@ -20,7 +20,7 @@ public class ArrayListTest extends JSR16 class Implementation implements CollectionImplementation { public Class klazz() { return ArrayList.class; } public List emptyCollection() { return new ArrayList(); } - public Object makeElement(int i) { return i; } + public Object makeElement(int i) { return JSR166TestCase.itemFor(i); } public boolean isConcurrent() { return false; } public boolean permitsNulls() { return true; } } @@ -39,21 +39,22 @@ public class ArrayListTest extends JSR16 * A cloned list equals original */ public void testClone() throws Exception { - ArrayList x = new ArrayList<>(); - x.add(1); - x.add(2); - x.add(3); - ArrayList y = (ArrayList) x.clone(); + ArrayList x = new ArrayList<>(); + x.add(one); + x.add(two); + x.add(three); + @SuppressWarnings("unchecked") + ArrayList y = (ArrayList) x.clone(); assertNotSame(y, x); - assertEquals(x, y); - assertEquals(y, x); - assertEquals(x.size(), y.size()); - assertEquals(x.toString(), y.toString()); + mustEqual(x, y); + mustEqual(y, x); + mustEqual(x.size(), y.size()); + mustEqual(x.toString(), y.toString()); assertTrue(Arrays.equals(x.toArray(), y.toArray())); while (!x.isEmpty()) { assertFalse(y.isEmpty()); - assertEquals(x.remove(0), y.remove(0)); + mustEqual(x.remove(0), y.remove(0)); } assertTrue(y.isEmpty()); }