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 NewSchemaValidatorWizardTest extends TestCase {
10 private static NewSchemaValidatorWizard wizard = null;
11
12 protected NewSchemaValidatorWizardTest(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 NewSchemaValidatorWizard(null);
22
23 wizard.setModal(false);
24
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 nextSchemaPage() throws Exception {
36 wizard.nextPage();
37
38 assertTrue(wizard.getPage() instanceof SchemaPage);
39 }
40
41 public void backFilterPage() throws Exception {
42 wizard.backPage();
43
44 assertTrue(wizard.getPage() instanceof InputFilterPage);
45 }
46
47 public void backInputTypePage() throws Exception {
48 wizard.backPage();
49
50 assertTrue(wizard.getPage() instanceof InputTypeSelectionPage);
51 }
52
53 public void nextURIsPage() throws Exception {
54 ((InputTypeSelectionPage)wizard.getPage()).selectInputURIs();
55
56 wizard.nextPage();
57
58 assertTrue(wizard.getPage() instanceof InputURIsPage);
59 }
60
61 public void cancelWizard() throws Exception {
62 wizard.cancel();
63
64 assertFalse(wizard.isVisible());
65 assertTrue(wizard.isCancelled());
66 }
67
68 public static Test suite() {
69 TestSuite suite = new TestSuite("New Schema Validator Wizard Test");
70
71 suite.addTest(new NewSchemaValidatorWizardTest("openWizard"));
72 suite.addTest(new NewSchemaValidatorWizardTest("nextFilterPage"));
73 suite.addTest(new NewSchemaValidatorWizardTest("nextSchemaPage"));
74 suite.addTest(new NewSchemaValidatorWizardTest("backFilterPage"));
75 suite.addTest(new NewSchemaValidatorWizardTest("backInputTypePage"));
76 suite.addTest(new NewSchemaValidatorWizardTest("nextURIsPage"));
77 suite.addTest(new NewSchemaValidatorWizardTest("nextSchemaPage"));
78 suite.addTest(new NewSchemaValidatorWizardTest("cancelWizard"));
79
80 return suite;
81 }
82 }