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

Comparing jsr166/src/test/tck/LinkedBlockingDequeTest.java (file contents):
Revision 1.62 by jsr166, Tue Oct 6 00:03:55 2015 UTC vs.
Revision 1.68 by jsr166, Sat Mar 25 21:41:10 2017 UTC

# Line 41 | Line 41 | public class LinkedBlockingDequeTest ext
41      }
42  
43      public static Test suite() {
44 +        class Implementation implements CollectionImplementation {
45 +            public Class<?> klazz() { return LinkedBlockingDeque.class; }
46 +            public Collection emptyCollection() { return new LinkedBlockingDeque(); }
47 +            public Object makeElement(int i) { return i; }
48 +            public boolean isConcurrent() { return true; }
49 +            public boolean permitsNulls() { return false; }
50 +        }
51          return newTestSuite(LinkedBlockingDequeTest.class,
52                              new Unbounded().testSuite(),
53 <                            new Bounded().testSuite());
53 >                            new Bounded().testSuite(),
54 >                            CollectionTest.testSuite(new Implementation()));
55      }
56  
57      /**
58       * Returns a new deque of given size containing consecutive
59 <     * Integers 0 ... n.
59 >     * Integers 0 ... n - 1.
60       */
61 <    private LinkedBlockingDeque<Integer> populatedDeque(int n) {
61 >    private static LinkedBlockingDeque<Integer> populatedDeque(int n) {
62          LinkedBlockingDeque<Integer> q =
63              new LinkedBlockingDeque<Integer>(n);
64          assertTrue(q.isEmpty());
# Line 59 | Line 67 | public class LinkedBlockingDequeTest ext
67          assertFalse(q.isEmpty());
68          assertEquals(0, q.remainingCapacity());
69          assertEquals(n, q.size());
70 +        assertEquals((Integer) 0, q.peekFirst());
71 +        assertEquals((Integer) (n - 1), q.peekLast());
72          return q;
73      }
74  
# Line 764 | Line 774 | public class LinkedBlockingDequeTest ext
774                  }
775              }});
776  
777 <        aboutToWait.await();
778 <        waitForThreadToEnterWaitState(t, LONG_DELAY_MS);
777 >        await(aboutToWait);
778 >        waitForThreadToEnterWaitState(t);
779          t.interrupt();
780          awaitTermination(t);
781          checkEmpty(q);
# Line 1379 | Line 1389 | public class LinkedBlockingDequeTest ext
1389                      shouldThrow();
1390                  } catch (InterruptedException success) {}
1391                  assertFalse(Thread.interrupted());
1392 +
1393 +                assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
1394              }});
1395  
1396          barrier.await();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines