View Javadoc
1   /**
2    * 
3    */
4   package org.melati.poem.util.test;
5   
6   import java.util.Vector;
7   
8   import org.melati.poem.util.ConsEnumeration;
9   import org.melati.poem.util.LimitedEnumeration;
10  
11  import junit.framework.TestCase;
12  
13  /**
14   * @author timp
15   * @since 30 May 2007
16   *
17   */
18  public class ConsEnumerationTest extends TestCase {
19  
20    /**
21     * @param name
22     */
23    public ConsEnumerationTest(String name) {
24      super(name);
25    }
26  
27    /** 
28     * {@inheritDoc}
29     * @see junit.framework.TestCase#setUp()
30     */
31    protected void setUp() throws Exception {
32      super.setUp();
33    }
34  
35    /** 
36     * {@inheritDoc}
37     * @see junit.framework.TestCase#tearDown()
38     */
39    protected void tearDown() throws Exception {
40      super.tearDown();
41    }
42  
43    /**
44     * Test method for {@link org.melati.poem.util.ConsEnumeration#ConsEnumeration(java.lang.Object, java.util.Enumeration)}.
45     */
46    public void testConsEnumeration() {
47      
48    }
49  
50    /**
51     * Test method for {@link org.melati.poem.util.ConsEnumeration#hasMoreElements()}.
52     */
53    public void testHasMoreElements() {
54      
55    }
56  
57    /**
58     * Test method for {@link org.melati.poem.util.ConsEnumeration#nextElement()}.
59     */
60    public void testNextElement() {
61      
62    }
63  
64    /**
65     * Test method for {@link org.melati.poem.util.ConsEnumeration#skip()}.
66     */
67    public void testSkip() {
68      ConsEnumeration<String> c = new ConsEnumeration<String>("head", new Vector<String>(1).elements());
69      assertTrue(c.hasMoreElements());
70      c.skip();
71      assertFalse(c.hasMoreElements());
72      
73      Vector<String> them = new Vector<String>();
74      them.add("a");
75      them.add("b");
76      them.add("c");
77      them.add("d");
78      LimitedEnumeration<String> le = new LimitedEnumeration<String>(them.elements(),2);
79      c = new ConsEnumeration<String>("head", le);
80      c.nextElement();
81      c.skip();
82      assertEquals("b", c.nextElement());
83      
84      c = new ConsEnumeration<String>("head", them.elements());
85      c.nextElement();
86      c.skip();
87      assertEquals("b", c.nextElement());
88    }
89  
90  }