View Javadoc
1   /**
2    * 
3    */
4   package org.melati.poem.util.test;
5   
6   import java.util.NoSuchElementException;
7   
8   import org.melati.poem.util.EmptyEnumeration;
9   
10  import junit.framework.TestCase;
11  
12  /**
13   * @author timp
14   * @since 29 May 2007
15   *
16   */
17  public class EmptyEnumerationTest extends TestCase {
18  
19    /**
20     * @param name
21     */
22    public EmptyEnumerationTest(String name) {
23      super(name);
24    }
25  
26    /** 
27     * {@inheritDoc}
28     * @see junit.framework.TestCase#setUp()
29     */
30    protected void setUp() throws Exception {
31      super.setUp();
32    }
33  
34    /** 
35     * {@inheritDoc}
36     * @see junit.framework.TestCase#tearDown()
37     */
38    protected void tearDown() throws Exception {
39      super.tearDown();
40    }
41  
42    /**
43     * Test method for {@link org.melati.poem.util.EmptyEnumeration#hasMoreElements()}.
44     */
45    public void testHasMoreElements() {
46      assertFalse(new EmptyEnumeration<String>().hasMoreElements());
47    }
48  
49    /**
50     * Test method for {@link org.melati.poem.util.EmptyEnumeration#nextElement()}.
51     */
52    public void testNextElement() {
53      try { 
54        new EmptyEnumeration<String>().nextElement();
55        fail("should have bombed");
56      } catch (NoSuchElementException e) {
57        e = null;      
58      }
59    }
60  
61  }