< prev index next >

test/jdk/java/util/Collections/EnumerationAsIterator.java

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

@@ -23,13 +23,15 @@
  
  /**
   * @test
   * @bug 8072726
   * @summary Tests for Enumeration-to-Iterator conversion.
+  * @library /test/lib
   * @run testng EnumerationAsIterator
   */
  
+ import jdk.test.lib.valueclass.VClass;
  import org.testng.annotations.DataProvider;
  import org.testng.annotations.Test;
  
  import java.util.ArrayList;
  import java.util.Arrays;

@@ -44,10 +46,11 @@
  
  import static org.testng.Assert.*;
  
  @Test
  public class EnumerationAsIterator {
+ 
      static Object[] of(String description, Supplier<Enumeration<?>> s, Collection<?> exp) {
          return new Object[]{description, s, exp};
      }
  
      static Object[] of(String description, Collection<?> c, Collection<?> exp) {

@@ -109,11 +112,15 @@
                 Collections.singletonList("a"),
                 Collections.singletonList("a")),
  
              of("Arrays.asList(...)",
                 Arrays.asList("a", "b", "c"),
-                Arrays.asList("a", "b", "c"))
+                Arrays.asList("a", "b", "c")),
+ 
+             of("Value Collections.enumeration()",
+                () -> Collections.enumeration(Arrays.asList(new VClass(1, new int[] { 1 }), new VClass(2, new int[] { 2 }))),
+                Arrays.asList(new VClass(1, new int[] { 1 }), new VClass(2, new int[] { 2 })))
          ).iterator();
      }
  
      @DataProvider
      public static Iterator<Object[]> all() {
< prev index next >