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,16 +21,16 @@
  * questions.
  */
 
 /*
  * @test
- * @bug 5017904 6356890
+ * @bug 5017904 6356890 8004928
  * @summary Test empty iterators, enumerations, and collections
  */
 
-import java.util.*;
 import static java.util.Collections.*;
+import java.util.*;
 
 public class EmptyIterator {
 
     void test(String[] args) throws Throwable {
         testEmptyCollection(Collections.<Object>emptyList());

@@ -45,15 +45,18 @@
         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());
+        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);
     }