--- jsr166/src/test/tck/LinkedListTest.java 2015/05/24 01:42:14 1.40 +++ jsr166/src/test/tck/LinkedListTest.java 2017/03/11 18:20:47 1.46 @@ -13,7 +13,6 @@ import java.util.LinkedList; import java.util.NoSuchElementException; import junit.framework.Test; -import junit.framework.TestSuite; public class LinkedListTest extends JSR166TestCase { public static void main(String[] args) { @@ -21,20 +20,37 @@ public class LinkedListTest extends JSR1 } public static Test suite() { - return new TestSuite(LinkedListTest.class); + class Implementation implements CollectionImplementation { + public Class klazz() { return LinkedList.class; } + public Collection emptyCollection() { return new LinkedList(); } + public Object makeElement(int i) { return i; } + public boolean isConcurrent() { return false; } + public boolean permitsNulls() { return true; } + } + class SubListImplementation extends Implementation { + public Collection emptyCollection() { + return new LinkedList().subList(0, 0); + } + } + return newTestSuite( + LinkedListTest.class, + CollectionTest.testSuite(new Implementation()), + CollectionTest.testSuite(new SubListImplementation())); } /** * Returns a new queue of given size containing consecutive - * Integers 0 ... n. + * Integers 0 ... n - 1. */ - private LinkedList populatedQueue(int n) { - LinkedList q = new LinkedList(); + private static LinkedList populatedQueue(int n) { + LinkedList q = new LinkedList<>(); assertTrue(q.isEmpty()); for (int i = 0; i < n; ++i) assertTrue(q.offer(new Integer(i))); assertFalse(q.isEmpty()); assertEquals(n, q.size()); + assertEquals((Integer) 0, q.peekFirst()); + assertEquals((Integer) (n - 1), q.peekLast()); return q; }