1   package com.sri.emo.wizard;
2   
3   import junit.framework.*;
4   import java.io.Serializable;
5   import java.util.List;
6   import java.util.Map;
7   
8   /***
9    * Test Case to deal with items not handled by other test cases in the abstract
10   * wizard.
11   * @author Michael Rimov
12   */
13  public class TestAbstractWizard extends TestCase {
14      private AbstractWizard abstractWizard = null;
15  
16      protected void setUp() throws Exception {
17          super.setUp();
18          abstractWizard = new AbstractWizard(null) {
19  
20              /***
21  			 * 
22  			 */
23  			private static final long serialVersionUID = 1L;
24  
25  			public WizardPage next(WizardPage src, Serializable newData) throws WizardException {
26                  throw new java.lang.UnsupportedOperationException("Not Implemented");
27              }
28  
29              protected WizardPage getInitialPage() {
30                 throw new java.lang.UnsupportedOperationException("Not Implemented");
31              }
32  
33              public List getStepHistory() throws WizardException {
34                  throw new java.lang.UnsupportedOperationException("Not Implemented");
35              }
36  
37  
38              public Map getAllData() throws WizardException {
39                 throw new java.lang.UnsupportedOperationException("Not Implemented");
40              }
41  
42  
43              public WizardPage getPageById(Serializable s) {
44                  throw new java.lang.UnsupportedOperationException("Not Implemented");
45              }
46  
47              public WizardPage backupToPage(Serializable s) {
48                  throw new java.lang.UnsupportedOperationException("Not Implemented");
49              }
50  
51          };
52  
53          abstractWizard.setTitle("Test");
54      }
55  
56      protected void tearDown() throws Exception {
57          abstractWizard = null;
58          super.tearDown();
59      }
60  
61      public void testEquals() {
62          assertFalse(abstractWizard.equals(null));
63          assertFalse(abstractWizard.equals(new Object()));
64      }
65  
66      public void testHashCode() {
67          assertEquals("Test".hashCode(), abstractWizard.hashCode());
68      }
69  
70      public void testGetCurrentPageBeforeBeginThrowsIllegalStateException() {
71          try {
72              abstractWizard.getCurrentPage();
73              fail("getCurrentPage before begin should have thrown illegal state exception");
74          } catch (IllegalStateException ex) {
75              //a-ok
76          	assertNotNull(ex.getMessage());
77          }
78  
79      }
80  
81      public void testToString() {
82          assertEquals("Test", abstractWizard.toString());
83      }
84  
85  }