### Question:
EnumerationUtils { public static <E> List<E> toList(final Enumeration<? extends E> enumeration) { return IteratorUtils.toList(new EnumerationIterator<E>(enumeration)); } private  EnumerationUtils(); static T get(final Enumeration<T> e, final int index); static List<E> toList(final Enumeration<? extends E> enumeration); static List<String> toList(final StringTokenizer stringTokenizer);  }### Answer:
@Test public void testToListWithStringTokenizer() { final List<String> expectedList1 = new ArrayList<String>(); final StringTokenizer st = new StringTokenizer(TO_LIST_FIXTURE); while (st.hasMoreTokens()) { expectedList1.add(st.nextToken()); } final List<String> expectedList2 = new ArrayList<String>(); expectedList2.add("this"); expectedList2.add("is"); expectedList2.add("a"); expectedList2.add("test"); final List<String> actualList = EnumerationUtils.toList(new StringTokenizer(TO_LIST_FIXTURE)); assertEquals(expectedList1, expectedList2); assertEquals(expectedList1, actualList); assertEquals(expectedList2, actualList); }
@Test public void testToListWithHashtable() { final Hashtable<String, Integer> expected = new Hashtable<String, Integer>(); expected.put("one", Integer.valueOf(1)); expected.put("two", Integer.valueOf(2)); expected.put("three", Integer.valueOf(3)); final List<Integer> actualEltList = EnumerationUtils.toList(expected.elements()); assertEquals(expected.size(), actualEltList.size()); assertTrue(actualEltList.contains(Integer.valueOf(1))); assertTrue(actualEltList.contains(Integer.valueOf(2))); assertTrue(actualEltList.contains(Integer.valueOf(3))); final List<Integer> expectedEltList = new ArrayList<Integer>(); expectedEltList.add(Integer.valueOf(1)); expectedEltList.add(Integer.valueOf(2)); expectedEltList.add(Integer.valueOf(3)); assertTrue(actualEltList.containsAll(expectedEltList)); final List<String> actualKeyList = EnumerationUtils.toList(expected.keys()); assertEquals(expected.size(), actualEltList.size()); assertTrue(actualKeyList.contains("one")); assertTrue(actualKeyList.contains("two")); assertTrue(actualKeyList.contains("three")); final List<String> expectedKeyList = new ArrayList<String>(); expectedKeyList.add("one"); expectedKeyList.add("two"); expectedKeyList.add("three"); assertTrue(actualKeyList.containsAll(expectedKeyList)); }