View Javadoc

1   package org.xmlhammer.gui.acceptance;
2   
3   import java.util.List;
4   
5   import junit.framework.Test;
6   import junit.framework.TestSuite;
7   
8   import org.xmlhammer.gui.ProjectView;
9   import org.xmlhammer.gui.schemavalidator.SchemaValidatorProjectView;
10  import org.xmlhammer.model.project.Document;
11  import org.xmlhammer.model.project.Project;
12  
13  public class NewSchemaValidationTest extends NewProjectTestCase {
14      private NewSchemaValidationTest(String test) {
15          super(test);
16      }
17  
18      public void newProject() throws Exception {
19          getApplication().getNewSchemaValidatorAction().runWithoutWizard();
20          
21          ProjectView view = getApplication().getProjectsView().getSelectedView();
22          assertNotNull(view);
23          assertTrue(view instanceof SchemaValidatorProjectView);
24      }
25      
26      public void checkProject() {
27          ProjectView view = getApplication().getProjectsView().getSelectedView();
28          Project project = view.getProject(null);
29      
30          List<Document> list = project.getInput().getSourceOrSourceAndResult();
31          assertEquals(0, list.size());
32          
33          assertNotNull(project.getSchemaValidator());
34          assertNull(project.getParser());
35          assertNull(project.getXSLT());
36          assertNull(project.getXPath());
37          assertNull(project.getJAXPSettings().getJAXPTransformerFactory());
38          assertNull(project.getJAXPSettings().getJAXPXPathFactory());
39          assertNull(project.getJAXPSettings().getJAXPDocumentBuilderFactory());
40          assertNotNull(project.getJAXPSettings().getJAXPSAXParserFactory());
41          assertNotNull(project.getJAXPSettings().getJAXPSchemaFactory());
42      }
43  
44      public static Test suite() {
45          TestSuite suite = new TestSuite("New Schema Validation Project");
46          
47          suite.addTest(new NewSchemaValidationTest("newProject"));
48          suite.addTest(new NewSchemaValidationTest("checkProject"));
49          suite.addTest(new NewSchemaValidationTest("initialPage"));
50          suite.addTest(new NewSchemaValidationTest("hasChanged"));
51          suite.addTest(new NewSchemaValidationTest("closeProject"));
52          suite.addTest(new NewSchemaValidationTest("closeApplication"));
53  
54          return suite;
55      }
56  }