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

Comparing jsr166/src/test/tck/Collection8Test.java (file contents):
Revision 1.8 by jsr166, Thu Nov 3 15:31:25 2016 UTC vs.
Revision 1.11 by jsr166, Sat Nov 5 05:09:57 2016 UTC

# Line 49 | Line 49 | public class Collection8Test extends JSR
49                                        impl);
50      }
51  
52 +    Object bomb() {
53 +        return new Object() {
54 +                public boolean equals(Object x) { throw new AssertionError(); }
55 +                public int hashCode() { throw new AssertionError(); }
56 +            };
57 +    }
58 +
59      /** Checks properties of empty collections. */
60      public void testEmptyMeansEmpty() {
61          Collection c = impl.emptyCollection();
# Line 81 | Line 88 | public class Collection8Test extends JSR
88          c.iterator().forEachRemaining(alwaysThrows);
89          c.spliterator().forEachRemaining(alwaysThrows);
90          assertFalse(c.spliterator().tryAdvance(alwaysThrows));
91 <        if (Queue.class.isAssignableFrom(impl.klazz())) {
91 >        if (c.spliterator().hasCharacteristics(Spliterator.SIZED))
92 >            assertEquals(0, c.spliterator().estimateSize());
93 >        assertFalse(c.contains(bomb()));
94 >        assertFalse(c.remove(bomb()));
95 >        if (c instanceof Queue) {
96              Queue q = (Queue) c;
97              assertNull(q.peek());
98              assertNull(q.poll());
99          }
100 <        if (Deque.class.isAssignableFrom(impl.klazz())) {
100 >        if (c instanceof Deque) {
101              Deque d = (Deque) c;
102              assertNull(d.peekFirst());
103              assertNull(d.peekLast());
104              assertNull(d.pollFirst());
105              assertNull(d.pollLast());
106              assertIteratorExhausted(d.descendingIterator());
107 +            d.descendingIterator().forEachRemaining(alwaysThrows);
108 +            assertFalse(d.removeFirstOccurrence(bomb()));
109 +            assertFalse(d.removeLastOccurrence(bomb()));
110          }
111      }
112  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines