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.7 by jsr166, Mon Oct 31 20:08:40 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  
# Line 182 | Line 196 | public class Collection8Test extends JSR
196              }
197          };
198          try {
199 +            assertFalse(survivors.contains(null));
200              try {
201                  boolean modified = c.removeIf(randomPredicate);
202                  if (!modified) {
# Line 203 | Line 218 | public class Collection8Test extends JSR
218              System.err.printf("n=%d%n", n);
219              System.err.printf("accepts=%s%n", accepts);
220              System.err.printf("rejects=%s%n", rejects);
221 <            System.err.println(survivors);
221 >            System.err.printf("survivors=%s%n", survivors);
222              System.err.printf("threw=%s%n", threwAt.get());
223              throw ex;
224          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines