View Javadoc

1   package org.xmlhammer.gui.wizard;
2   
3   import junit.framework.Test;
4   import junit.framework.TestCase;
5   import junit.framework.TestSuite;
6   
7   import org.xmlhammer.PreferencesHandler;
8   
9   public class NewStylesheetValidatorWizardTest extends TestCase {
10      private static NewStylesheetValidatorWizard wizard = null;
11      
12      protected NewStylesheetValidatorWizardTest(String test) {
13          super(test);
14      }
15  
16      protected void setUp() throws Exception {
17          PreferencesHandler.getInstance().useDefaultPreferences();
18      }
19      
20      public void openWizard() throws Exception {
21          wizard = new NewStylesheetValidatorWizard(null);
22  
23          wizard.setModal(false);
24  //        wizard.setVisible(true);
25          
26          assertTrue(wizard.getPage() instanceof InputTypeSelectionPage);
27      }
28      
29      public void nextFilterPage() throws Exception {
30          wizard.nextPage();
31          
32          assertTrue(wizard.getPage() instanceof InputFilterPage);
33      }
34  
35      public void backInputTypePage() throws Exception {
36          wizard.backPage();
37          
38          assertTrue(wizard.getPage() instanceof InputTypeSelectionPage);
39      }
40  
41      public void nextURIsPage() throws Exception {
42          ((InputTypeSelectionPage)wizard.getPage()).selectInputURIs();
43          
44          wizard.nextPage();
45          
46          assertTrue(wizard.getPage() instanceof InputURIsPage);
47      }
48  
49      public void cancelWizard() throws Exception {
50          wizard.cancel();
51          
52          assertFalse(wizard.isVisible());
53          assertTrue(wizard.isCancelled());
54      }
55  
56      public static Test suite() {
57          TestSuite suite = new TestSuite("New Stylesheet Validator Wizard Test");
58          
59          suite.addTest(new NewStylesheetValidatorWizardTest("openWizard"));
60          suite.addTest(new NewStylesheetValidatorWizardTest("nextFilterPage"));
61          suite.addTest(new NewStylesheetValidatorWizardTest("backInputTypePage"));
62          suite.addTest(new NewStylesheetValidatorWizardTest("nextURIsPage"));
63          suite.addTest(new NewStylesheetValidatorWizardTest("cancelWizard"));
64  
65          return suite;
66      }
67  }