KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > inversoft > util > test > IteratorEnumerationTest


1 /*
2  * Copyright (c) 2003-2004, Inversoft
3  *
4  * This software is distribuable under the GNU Lesser General Public License.
5  * For more information visit gnu.org.
6  */

7 package com.inversoft.util.test;
8
9
10 import java.util.ArrayList JavaDoc;
11 import java.util.List JavaDoc;
12
13 import junit.framework.TestCase;
14
15 import com.inversoft.util.IteratorEnumeration;
16
17
18 /**
19  * <p>
20  * This class tests the iterator to enumeration adapter.
21  * </p>
22  *
23  * @author Brian Pontarelli
24  */

25 public class IteratorEnumerationTest extends TestCase {
26
27     /**
28      * Constructs a new test.
29      */

30     public IteratorEnumerationTest(String JavaDoc name) {
31         super(name);
32     }
33
34
35     public void testAll() {
36         List JavaDoc list = new ArrayList JavaDoc();
37         list.add("foo");
38         list.add("bar");
39
40         IteratorEnumeration adapter = new IteratorEnumeration(list.iterator());
41         assertTrue(adapter.hasMoreElements());
42         assertEquals("foo", adapter.nextElement());
43         assertTrue(adapter.hasMoreElements());
44         assertEquals("bar", adapter.nextElement());
45         assertFalse(adapter.hasMoreElements());
46     }
47 }
48
Popular Tags