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

Comparing jsr166/src/test/tck/ConcurrentLinkedDequeTest.java (file contents):
Revision 1.22 by jsr166, Sun May 24 01:42:14 2015 UTC vs.
Revision 1.29 by jsr166, Fri Aug 4 03:30:21 2017 UTC

# Line 16 | Line 16 | import java.util.Random;
16   import java.util.concurrent.ConcurrentLinkedDeque;
17  
18   import junit.framework.Test;
19 import junit.framework.TestSuite;
19  
20   public class ConcurrentLinkedDequeTest extends JSR166TestCase {
21  
# Line 25 | Line 24 | public class ConcurrentLinkedDequeTest e
24      }
25  
26      public static Test suite() {
27 <        return new TestSuite(ConcurrentLinkedDequeTest.class);
27 >        class Implementation implements CollectionImplementation {
28 >            public Class<?> klazz() { return ConcurrentLinkedDeque.class; }
29 >            public Collection emptyCollection() { return new ConcurrentLinkedDeque(); }
30 >            public Object makeElement(int i) { return i; }
31 >            public boolean isConcurrent() { return true; }
32 >            public boolean permitsNulls() { return false; }
33 >        }
34 >        return newTestSuite(ConcurrentLinkedDequeTest.class,
35 >                            CollectionTest.testSuite(new Implementation()));
36      }
37  
38      /**
39       * Returns a new deque of given size containing consecutive
40 <     * Integers 0 ... n.
40 >     * Integers 0 ... n - 1.
41       */
42 <    private ConcurrentLinkedDeque<Integer> populatedDeque(int n) {
43 <        ConcurrentLinkedDeque<Integer> q = new ConcurrentLinkedDeque<Integer>();
42 >    private static ConcurrentLinkedDeque<Integer> populatedDeque(int n) {
43 >        ConcurrentLinkedDeque<Integer> q = new ConcurrentLinkedDeque<>();
44          assertTrue(q.isEmpty());
45          for (int i = 0; i < n; ++i)
46              assertTrue(q.offer(new Integer(i)));
47          assertFalse(q.isEmpty());
48          assertEquals(n, q.size());
49 +        assertEquals((Integer) 0, q.peekFirst());
50 +        assertEquals((Integer) (n - 1), q.peekLast());
51          return q;
52      }
53  
# Line 303 | Line 312 | public class ConcurrentLinkedDequeTest e
312      }
313  
314      /**
315 <     * addAll(this) throws IAE
315 >     * addAll(this) throws IllegalArgumentException
316       */
317      public void testAddAllSelf() {
318          ConcurrentLinkedDeque q = populatedDeque(SIZE);
# Line 853 | Line 862 | public class ConcurrentLinkedDequeTest e
862      }
863  
864      /**
865 <     * A deserialized serialized deque has same elements in same order
865 >     * A deserialized/reserialized deque has same elements in same order
866       */
867      public void testSerialization() throws Exception {
868          Queue x = populatedDeque(SIZE);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines