View Javadoc

1   package org.xmlhammer.gui.acceptance;
2   
3   import java.io.File;
4   
5   import javax.swing.tree.MutableTreeNode;
6   
7   import junit.framework.Test;
8   import junit.framework.TestSuite;
9   
10  import org.xmlhammer.gui.output.ResultTreeModel;
11  
12  public class XMLParserTest extends ProjectTestCase {
13      private XMLParserTest(String test) {
14          super(test);
15      }
16  
17      public void openInternalXSDDOMProject() throws Exception {
18          openProject(new File("src/test/resources/projects/validator/contact-internal-xsd-invalid-dom.xhp"));
19      }
20      
21      public void openInternalXSDSAXProject() throws Exception {
22          openProject(new File("src/test/resources/projects/validator/contact-internal-xsd-invalid-sax.xhp"));
23      }
24  
25      public void openXSDSAXProject() throws Exception {
26          openProject(new File("src/test/resources/projects/validator/contact-xsd-invalid-sax.xhp"));
27      }
28  
29      public void openDTDSAXProject() throws Exception {
30          openProject(new File("src/test/resources/projects/validator/contact-dtd-invalid-sax.xhp"));
31      }
32  
33      public void execute() {
34          super.execute();
35  
36          ResultTreeModel model = getApplication().getProjectsView().getSelectedView().getResultPanel().getModel();
37          assertEquals(3, ((MutableTreeNode)model.getRoot()).getChildAt(0).getChildCount());
38      }
39  
40      public void executeDTD() {
41          super.execute();
42  
43          ResultTreeModel model = getApplication().getProjectsView().getSelectedView().getResultPanel().getModel();
44          assertEquals(4, ((MutableTreeNode)model.getRoot()).getChildAt(0).getChildCount());
45      }
46  
47      public static Test suite() {
48          TestSuite suite = new TestSuite("XML Parser Projects");
49          
50          suite.addTest(new XMLParserTest("openInternalXSDDOMProject"));
51          suite.addTest(new XMLParserTest("initialPage"));
52          suite.addTest(new XMLParserTest("hasChanged"));
53          suite.addTest(new XMLParserTest("execute"));
54          suite.addTest(new XMLParserTest("closeProject"));
55          suite.addTest(new XMLParserTest("openInternalXSDSAXProject"));
56          suite.addTest(new XMLParserTest("initialPage"));
57          suite.addTest(new XMLParserTest("hasChanged"));
58          suite.addTest(new XMLParserTest("execute"));
59          suite.addTest(new XMLParserTest("closeProject"));
60          suite.addTest(new XMLParserTest("openXSDSAXProject"));
61          suite.addTest(new XMLParserTest("initialPage"));
62          suite.addTest(new XMLParserTest("hasChanged"));
63          suite.addTest(new XMLParserTest("execute"));
64          suite.addTest(new XMLParserTest("closeProject"));
65          suite.addTest(new XMLParserTest("openDTDSAXProject"));
66          suite.addTest(new XMLParserTest("initialPage"));
67          suite.addTest(new XMLParserTest("hasChanged"));
68          suite.addTest(new XMLParserTest("executeDTD"));
69          suite.addTest(new XMLParserTest("closeProject"));
70          suite.addTest(new XMLParserTest("closeApplication"));
71  
72          return suite;
73      }
74  }