View Javadoc
1   /**
2    * 
3    */
4   package org.melati.poem;
5   
6   import java.util.NoSuchElementException;
7   
8   import junit.framework.TestCase;
9   
10  /**
11   * @author timp
12   *
13   */
14  public class BooleanPossibleRawEnumerationTest extends TestCase {
15  
16    /**
17     * @see org.melati.poem.BooleanPossibleRawEnumeration#hasMoreElements()
18     */
19    public void testHasMoreElements() {
20      // see below
21    }
22  
23    /**
24     * @see org.melati.poem.BooleanPossibleRawEnumeration#nextElement()
25     */
26    public void testNextElement() {
27      BooleanPossibleRawEnumeration en = new BooleanPossibleRawEnumeration();
28      assertTrue(en.hasMoreElements());
29      Object o = en.nextElement();
30      assertEquals(Boolean.FALSE,o);
31      assertTrue(en.hasMoreElements());
32      o = en.nextElement();
33      assertEquals(Boolean.TRUE,o);
34      assertFalse(en.hasMoreElements());
35      try {
36        o = en.nextElement();
37        fail("Should have thrown NoSuchElementException");      
38      } catch (Exception e) {
39        assertTrue(e instanceof NoSuchElementException);
40      }
41  
42    }
43  
44  }