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.stylesheetvalidator.StylesheetValidatorProjectView;
10  import org.xmlhammer.model.project.Document;
11  import org.xmlhammer.model.project.Project;
12  
13  public class NewStylesheetValidationTest extends NewProjectTestCase {
14      private NewStylesheetValidationTest(String test) {
15          super(test);
16      }
17  
18      public void newProject() throws Exception {
19          getApplication().getNewStylesheetValidatorAction().runWithoutWizard();
20          
21          ProjectView view = getApplication().getProjectsView().getSelectedView();
22          assertNotNull(view);
23          assertTrue(view instanceof StylesheetValidatorProjectView);
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          assertNull(project.getSchemaValidator());
34          assertNull(project.getParser());
35          assertNull(project.getXSLT());
36          assertNull(project.getXPath());
37          assertNotNull(project.getJAXPSettings().getJAXPTransformerFactory());
38          assertNull(project.getJAXPSettings().getJAXPXPathFactory());
39          assertNull(project.getJAXPSettings().getJAXPDocumentBuilderFactory());
40          assertNull(project.getJAXPSettings().getJAXPSAXParserFactory());
41          assertNotNull(project.getJAXPSettings().getJAXPSchemaFactory());
42      }
43  
44      public static Test suite() {
45          TestSuite suite = new TestSuite("New Stylesheet Validation Project");
46          
47          suite.addTest(new NewStylesheetValidationTest("newProject"));
48          suite.addTest(new NewStylesheetValidationTest("checkProject"));
49          suite.addTest(new NewStylesheetValidationTest("initialPage"));
50          suite.addTest(new NewStylesheetValidationTest("hasChanged"));
51          suite.addTest(new NewStylesheetValidationTest("closeProject"));
52          suite.addTest(new NewStylesheetValidationTest("closeApplication"));
53  
54          return suite;
55      }
56  }