[cvs] / jsr166 / src / test / tck / LinkedListTest.java Repository:
ViewVC logotype

Diff of /jsr166/src/test/tck/LinkedListTest.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.39, Sat May 23 00:53:08 2015 UTC revision 1.45, Sat Mar 11 17:33:32 2017 UTC
# Line 13  Line 13 
13  import java.util.NoSuchElementException;  import java.util.NoSuchElementException;
14    
15  import junit.framework.Test;  import junit.framework.Test;
 import junit.framework.TestSuite;  
16    
17  public class LinkedListTest extends JSR166TestCase {  public class LinkedListTest extends JSR166TestCase {
18      public static void main(String[] args) {      public static void main(String[] args) {
# Line 21  Line 20 
20      }      }
21    
22      public static Test suite() {      public static Test suite() {
23          return new TestSuite(LinkedListTest.class);          class Implementation implements CollectionImplementation {
24                public Class<?> klazz() { return LinkedList.class; }
25                public Collection emptyCollection() { return new LinkedList(); }
26                public Object makeElement(int i) { return i; }
27                public boolean isConcurrent() { return false; }
28                public boolean permitsNulls() { return true; }
29            }
30            class SubListImplementation extends Implementation {
31                public Collection emptyCollection() {
32                    return new LinkedList().subList(0, 0);
33                }
34            }
35            return newTestSuite(
36                    LinkedListTest.class,
37                    CollectionTest.testSuite(new Implementation()),
38                    CollectionTest.testSuite(new SubListImplementation()));
39      }      }
40    
41      /**      /**
42       * Returns a new queue of given size containing consecutive       * Returns a new queue of given size containing consecutive
43       * Integers 0 ... n.       * Integers 0 ... n - 1.
44       */       */
45      private LinkedList<Integer> populatedQueue(int n) {      private LinkedList<Integer> populatedQueue(int n) {
46          LinkedList<Integer> q = new LinkedList<Integer>();          LinkedList<Integer> q = new LinkedList<>();
47          assertTrue(q.isEmpty());          assertTrue(q.isEmpty());
48          for (int i = 0; i < n; ++i)          for (int i = 0; i < n; ++i)
49              assertTrue(q.offer(new Integer(i)));              assertTrue(q.offer(new Integer(i)));
50          assertFalse(q.isEmpty());          assertFalse(q.isEmpty());
51          assertEquals(n, q.size());          assertEquals(n, q.size());
52            assertEquals((Integer) 0, q.peekFirst());
53            assertEquals((Integer) (n - 1), q.peekLast());
54          return q;          return q;
55      }      }
56    

Legend:
Removed from v.1.39  
changed lines
  Added in v.1.45

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8