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.XMLValidatorProjectView;
10  import org.xmlhammer.model.project.Document;
11  import org.xmlhammer.model.project.Project;
12  
13  public class NewValidationTest extends NewProjectTestCase {
14      private NewValidationTest(String test) {
15          super(test);
16      }
17  
18      public void newProject() throws Exception {
19          getApplication().getNewXMLValidatorAction().runWithoutWizard();
20          
21          ProjectView view = getApplication().getProjectsView().getSelectedView();
22          assertNotNull(view);
23          assertTrue(view instanceof XMLValidatorProjectView);
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.getParser());
34          assertNull(project.getXSLT());
35          assertNull(project.getXPath());
36          assertNull(project.getSchemaValidator());
37          assertNull(project.getJAXPSettings().getJAXPTransformerFactory());
38          assertNull(project.getJAXPSettings().getJAXPXPathFactory());
39          assertNotNull(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 XML Parser Project");
46          
47          suite.addTest(new NewValidationTest("newProject"));
48          suite.addTest(new NewValidationTest("checkProject"));
49          suite.addTest(new NewValidationTest("initialPage"));
50          suite.addTest(new NewValidationTest("hasChanged"));
51          suite.addTest(new NewValidationTest("closeProject"));
52          suite.addTest(new NewValidationTest("closeApplication"));
53  
54          return suite;
55      }
56  }