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(); |
90 |
|
assertFalse(c.spliterator().tryAdvance(alwaysThrows)); |
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 (Queue.class.isAssignableFrom(impl.klazz())) { |
96 |
|
Queue q = (Queue) c; |
97 |
|
assertNull(q.peek()); |
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 |
|
|