2009/05/20 - Apache Shale has been retired.
For more information, please explore the Attic.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.shale.test.mock;
19
20 import java.util.Enumeration;
21 import java.util.Iterator;
22
23 /***
24 * <p>Mock implementation of an <code>Enumeration</code> wrapper around
25 * an <code>Iterator</code>.</p>
26 *
27 * $Id$
28 */
29
30 class MockEnumeration implements Enumeration {
31
32
33
34
35
36 /***
37 * <p>Construct a wrapper instance.</p>
38 *
39 * @param iterator The <code>Iterator</code> to be wrapped
40 */
41 public MockEnumeration(Iterator iterator) {
42
43 this.iterator = iterator;
44
45 }
46
47
48
49
50
51
52
53
54 /***
55 * <p>The <code>Iterator</code> we are wrapping.</p>
56 */
57 private Iterator iterator;
58
59
60
61
62
63 /*** {@inheritDoc} */
64 public boolean hasMoreElements() {
65
66 return iterator.hasNext();
67
68 }
69
70
71 /*** {@inheritDoc} */
72 public Object nextElement() {
73
74 return iterator.next();
75
76 }
77
78
79 }