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.5 by jsr166, Tue Oct 25 01:32:55 2016 UTC vs.
Revision 1.9 by jsr166, Thu Nov 3 16:53:13 2016 UTC

# Line 81 | Line 81 | public class Collection8Test extends JSR
81          c.iterator().forEachRemaining(alwaysThrows);
82          c.spliterator().forEachRemaining(alwaysThrows);
83          assertFalse(c.spliterator().tryAdvance(alwaysThrows));
84 +        if (c.spliterator().hasCharacteristics(Spliterator.SIZED))
85 +            assertEquals(0, c.spliterator().estimateSize());
86          if (Queue.class.isAssignableFrom(impl.klazz())) {
87              Queue q = (Queue) c;
88              assertNull(q.peek());
# Line 93 | Line 95 | public class Collection8Test extends JSR
95              assertNull(d.pollFirst());
96              assertNull(d.pollLast());
97              assertIteratorExhausted(d.descendingIterator());
98 +            d.descendingIterator().forEachRemaining(alwaysThrows);
99          }
100      }
101  
# Line 105 | Line 108 | public class Collection8Test extends JSR
108              () -> c.retainAll(null),
109              () -> c.removeAll(null),
110              () -> c.removeIf(null),
111 +            () -> c.forEach(null),
112 +            () -> c.iterator().forEachRemaining(null),
113 +            () -> c.spliterator().forEachRemaining(null),
114 +            () -> c.spliterator().tryAdvance(null),
115              () -> c.toArray(null));
116  
117          if (!impl.permitsNulls()) {
# Line 128 | Line 135 | public class Collection8Test extends JSR
135                  () -> d.addLast(null),
136                  () -> d.offerFirst(null),
137                  () -> d.offerLast(null),
138 <                () -> d.push(null));
138 >                () -> d.push(null),
139 >                () -> d.descendingIterator().forEachRemaining(null));
140          }
141      }
142  
# Line 177 | Line 185 | public class Collection8Test extends JSR
185              }
186          };
187          try {
188 <            boolean modified = c.removeIf(randomPredicate);
189 <            if (!modified) {
190 <                assertNull(threwAt.get());
191 <                assertEquals(n, rejects.size());
192 <                assertEquals(0, accepts.size());
193 <            }
194 <        } catch (ArithmeticException ok) {}
195 <        survivors.removeAll(accepts);
196 <        if (n - accepts.size() != c.size()) {
188 >            assertFalse(survivors.contains(null));
189 >            try {
190 >                boolean modified = c.removeIf(randomPredicate);
191 >                if (!modified) {
192 >                    assertNull(threwAt.get());
193 >                    assertEquals(n, rejects.size());
194 >                    assertEquals(0, accepts.size());
195 >                }
196 >            } catch (ArithmeticException ok) {}
197 >            survivors.removeAll(accepts);
198 >            assertEquals(n - accepts.size(), c.size());
199 >            assertTrue(c.containsAll(survivors));
200 >            assertTrue(survivors.containsAll(rejects));
201 >            for (Object x : accepts) assertFalse(c.contains(x));
202 >            if (threwAt.get() == null)
203 >                assertEquals(accepts.size() + rejects.size(), n);
204 >        } catch (Throwable ex) {
205              System.err.println(impl.klazz());
206 <            System.err.println(c);
207 <            System.err.println(accepts);
208 <            System.err.println(rejects);
209 <            System.err.println(survivors);
210 <            System.err.println(threwAt.get());
211 <        }
212 <        assertEquals(n - accepts.size(), c.size());
213 <        assertTrue(c.containsAll(survivors));
198 <        assertTrue(survivors.containsAll(rejects));
199 <        for (Object x : accepts) assertFalse(c.contains(x));
200 <        if (threwAt.get() == null)
201 <            assertEquals(accepts.size() + rejects.size(), n);
206 >            System.err.printf("c=%s%n", c);
207 >            System.err.printf("n=%d%n", n);
208 >            System.err.printf("accepts=%s%n", accepts);
209 >            System.err.printf("rejects=%s%n", rejects);
210 >            System.err.printf("survivors=%s%n", survivors);
211 >            System.err.printf("threw=%s%n", threwAt.get());
212 >            throw ex;
213 >        }
214      }
215  
216      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines