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 StylesheetValidatorTest extends ProjectTestCase {
13      private StylesheetValidatorTest(String test) {
14          super(test);
15      }
16  
17      public void openInvalidProject() throws Exception {
18          openProject(new File("src/test/resources/projects/stylesheetvalidator/stylesheet-invalid.xhp"));
19      }
20      
21      public void executeInvalid() {
22          super.execute();
23  
24          ResultTreeModel model = getApplication().getProjectsView().getSelectedView().getResultPanel().getModel();
25          assertEquals(4, ((MutableTreeNode)model.getRoot()).getChildAt(0).getChildCount());
26      }
27  
28      public void openValidProject() throws Exception {
29          openProject(new File("src/test/resources/projects/stylesheetvalidator/stylesheet-valid.xhp"));
30      }
31      
32      public void executeValid() {
33          super.execute();
34  
35          ResultTreeModel model = getApplication().getProjectsView().getSelectedView().getResultPanel().getModel();
36          assertEquals(0, ((MutableTreeNode)model.getRoot()).getChildAt(0).getChildCount());
37      }
38  
39      public static Test suite() {
40          TestSuite suite = new TestSuite("Stylesheet Validator Projects");
41          
42          suite.addTest(new StylesheetValidatorTest("openInvalidProject"));
43          suite.addTest(new StylesheetValidatorTest("initialPage"));
44          suite.addTest(new StylesheetValidatorTest("hasChanged"));
45          suite.addTest(new StylesheetValidatorTest("executeInvalid"));
46          suite.addTest(new StylesheetValidatorTest("closeProject"));
47          suite.addTest(new StylesheetValidatorTest("openValidProject"));
48          suite.addTest(new StylesheetValidatorTest("initialPage"));
49          suite.addTest(new StylesheetValidatorTest("hasChanged"));
50          suite.addTest(new StylesheetValidatorTest("executeValid"));
51          suite.addTest(new StylesheetValidatorTest("closeProject"));
52          suite.addTest(new StylesheetValidatorTest("closeApplication"));
53  
54          return suite;
55      }
56  
57  }