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.45 by jsr166, Sat Nov 26 05:42:14 2011 UTC vs.
Revision 1.50 by jsr166, Sun Nov 23 22:27:06 2014 UTC

# Line 8 | Line 8 | import junit.framework.*;
8   import java.util.Arrays;
9   import java.util.ArrayList;
10   import java.util.Collection;
11 + import java.util.Deque;
12   import java.util.Iterator;
13   import java.util.NoSuchElementException;
14   import java.util.Queue;
# Line 44 | Line 45 | public class LinkedBlockingDequeTest ext
45      }
46  
47      /**
48 <     * Create a deque of given size containing consecutive
48 >     * Returns a new deque of given size containing consecutive
49       * Integers 0 ... n.
50       */
51      private LinkedBlockingDeque<Integer> populatedDeque(int n) {
# Line 1064 | Line 1065 | public class LinkedBlockingDequeTest ext
1065  
1066                  pleaseInterrupt.countDown();
1067                  try {
1068 <                    q.pollFirst(SMALL_DELAY_MS, MILLISECONDS);
1068 >                    q.pollFirst(LONG_DELAY_MS, MILLISECONDS);
1069                      shouldThrow();
1070                  } catch (InterruptedException success) {}
1071                  assertFalse(Thread.interrupted());
# Line 1700 | Line 1701 | public class LinkedBlockingDequeTest ext
1701          Queue x = populatedDeque(SIZE);
1702          Queue y = serialClone(x);
1703  
1704 <        assertTrue(x != y);
1704 >        assertNotSame(y, x);
1705          assertEquals(x.size(), y.size());
1706          assertEquals(x.toString(), y.toString());
1707          assertTrue(Arrays.equals(x.toArray(), y.toArray()));
# Line 1774 | Line 1775 | public class LinkedBlockingDequeTest ext
1775          }
1776      }
1777  
1778 +    /**
1779 +     * remove(null), contains(null) always return false
1780 +     */
1781 +    public void testNeverContainsNull() {
1782 +        Deque<?>[] qs = {
1783 +            new LinkedBlockingDeque<Object>(),
1784 +            populatedDeque(2),
1785 +        };
1786 +
1787 +        for (Deque<?> q : qs) {
1788 +            assertFalse(q.contains(null));
1789 +            assertFalse(q.remove(null));
1790 +            assertFalse(q.removeFirstOccurrence(null));
1791 +            assertFalse(q.removeLastOccurrence(null));
1792 +        }
1793 +    }
1794 +
1795   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines