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.12 by jsr166, Thu May 30 03:28:55 2013 UTC vs.
Revision 1.13 by jsr166, Sun Nov 23 22:27:06 2014 UTC

# Line 9 | Line 9
9   import junit.framework.*;
10   import java.util.Arrays;
11   import java.util.Collection;
12 + import java.util.Deque;
13   import java.util.Iterator;
14   import java.util.NoSuchElementException;
15   import java.util.Queue;
# Line 861 | Line 862 | public class ConcurrentLinkedDequeTest e
862          assertTrue(y.isEmpty());
863      }
864  
865 +    /**
866 +     * contains(null) always return false.
867 +     * remove(null) always throws NullPointerException.
868 +     */
869 +    public void testNeverContainsNull() {
870 +        Deque<?>[] qs = {
871 +            new ConcurrentLinkedDeque<Object>(),
872 +            populatedDeque(2),
873 +        };
874 +
875 +        for (Deque<?> q : qs) {
876 +            assertFalse(q.contains(null));
877 +            try {
878 +                assertFalse(q.remove(null));
879 +                shouldThrow();
880 +            } catch (NullPointerException success) {}
881 +            try {
882 +                assertFalse(q.removeFirstOccurrence(null));
883 +                shouldThrow();
884 +            } catch (NullPointerException success) {}
885 +            try {
886 +                assertFalse(q.removeLastOccurrence(null));
887 +                shouldThrow();
888 +            } catch (NullPointerException success) {}
889 +        }
890 +    }
891   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines