test/java/util/Collection/MOAT.java
Print this page
rev 8045 : 8023339: Refined Collection.removeIf UOE conditions
Reviewed-by: duke
*** 205,216 ****
THROWS(NoSuchElementException.class,
new Fun(){void f(){ it.next(); }});
try { it.remove(); }
! catch (IllegalStateException _) { pass(); }
! catch (UnsupportedOperationException _) { pass(); }
catch (Throwable t) { unexpected(t); }
if (rnd.nextBoolean())
check(! it.hasNext());
}
--- 205,216 ----
THROWS(NoSuchElementException.class,
new Fun(){void f(){ it.next(); }});
try { it.remove(); }
! catch (IllegalStateException ignored) { pass(); }
! catch (UnsupportedOperationException ignored) { pass(); }
catch (Throwable t) { unexpected(t); }
if (rnd.nextBoolean())
check(! it.hasNext());
}
*** 278,290 ****
testEmptySet(m.keySet());
testEmptySet(m.entrySet());
testEmptyCollection(m.values());
try { check(! m.containsValue(null)); }
! catch (NullPointerException _) { /* OK */ }
try { check(! m.containsKey(null)); }
! catch (NullPointerException _) { /* OK */ }
check(! m.containsValue(1));
check(! m.containsKey(1));
}
private static void testImmutableMap(final Map<Integer,Integer> m) {
--- 278,290 ----
testEmptySet(m.keySet());
testEmptySet(m.entrySet());
testEmptyCollection(m.values());
try { check(! m.containsValue(null)); }
! catch (NullPointerException ignored) { /* OK */ }
try { check(! m.containsKey(null)); }
! catch (NullPointerException ignored) { /* OK */ }
check(! m.containsValue(1));
check(! m.containsKey(1));
}
private static void testImmutableMap(final Map<Integer,Integer> m) {
*** 708,719 ****
//----------------------------------------------------------------
try {
l.addAll(-1, Collections.<Integer>emptyList());
fail("Expected IndexOutOfBoundsException not thrown");
}
! catch (UnsupportedOperationException _) {/* OK */}
! catch (IndexOutOfBoundsException _) {/* OK */}
catch (Throwable t) { unexpected(t); }
// equal(l instanceof Serializable,
// l.subList(0,0) instanceof Serializable);
if (l.subList(0,0) instanceof Serializable)
--- 708,719 ----
//----------------------------------------------------------------
try {
l.addAll(-1, Collections.<Integer>emptyList());
fail("Expected IndexOutOfBoundsException not thrown");
}
! catch (UnsupportedOperationException ignored) {/* OK */}
! catch (IndexOutOfBoundsException ignored) {/* OK */}
catch (Throwable t) { unexpected(t); }
// equal(l instanceof Serializable,
// l.subList(0,0) instanceof Serializable);
if (l.subList(0,0) instanceof Serializable)