test/java/util/Collections/EmptyIterator.java

Print this page
rev 5551 : 8004928: TEST_BUG: Reduce dependence of CoreLib tests from the AWT subsystem
Summary: the tests were refactored to drop AWT dependence where it was possible.
Reviewed-by: alanb, mchung

*** 21,36 **** * questions. */ /* * @test ! * @bug 5017904 6356890 * @summary Test empty iterators, enumerations, and collections */ - import java.util.*; import static java.util.Collections.*; public class EmptyIterator { void test(String[] args) throws Throwable { testEmptyCollection(Collections.<Object>emptyList()); --- 21,36 ---- * questions. */ /* * @test ! * @bug 5017904 6356890 8004928 * @summary Test empty iterators, enumerations, and collections */ import static java.util.Collections.*; + import java.util.*; public class EmptyIterator { void test(String[] args) throws Throwable { testEmptyCollection(Collections.<Object>emptyList());
*** 45,59 **** testEmptyEnumeration(emptyTable.elements()); testEmptyIterator(emptyTable.keySet().iterator()); testEmptyIterator(emptyTable.values().iterator()); testEmptyIterator(emptyTable.entrySet().iterator()); ! testEmptyEnumeration(javax.swing.tree.DefaultMutableTreeNode ! .EMPTY_ENUMERATION); ! testEmptyEnumeration(javax.swing.text.SimpleAttributeSet ! .EMPTY.getAttributeNames()); @SuppressWarnings("unchecked") Iterator<?> x = new sun.tools.java.MethodSet() .lookupName(sun.tools.java.Identifier.lookup("")); testEmptyIterator(x); } --- 45,62 ---- testEmptyEnumeration(emptyTable.elements()); testEmptyIterator(emptyTable.keySet().iterator()); testEmptyIterator(emptyTable.values().iterator()); testEmptyIterator(emptyTable.entrySet().iterator()); ! final Enumeration<EmptyIterator> finalEmptyTyped = ! Collections.emptyEnumeration(); ! testEmptyEnumeration(finalEmptyTyped); + final Enumeration finalEmptyAbstract = + Collections.emptyEnumeration(); + testEmptyEnumeration(finalEmptyAbstract); + @SuppressWarnings("unchecked") Iterator<?> x = new sun.tools.java.MethodSet() .lookupName(sun.tools.java.Identifier.lookup("")); testEmptyIterator(x); }