1 19 20 package org.netbeans.modules.xml.tools.actions; 21 22 import junit.textui.TestRunner; 23 import org.netbeans.api.xml.cookies.CheckXMLCookie; 24 import org.openide.nodes.Node; 25 26 public class CheckActionTest extends AbstractCheckTest { 27 28 29 public CheckActionTest(String testName) { 30 super(testName); 31 } 32 33 35 37 38 public void testIncorrectlyNestedTags() throws Exception { 39 performAction("IncorrectlyNestedTags.xml", new int[] {6}); 40 } 41 42 43 public void testMissingClosingTag() throws Exception { 44 performAction("MissingClosingTag.xml", new int[] {7}); 45 } 46 47 48 public void testMissingRootElement() throws Exception { 49 performAction("MissingRootElement.xml", new int[] {-1}); 50 } 51 52 54 55 public void testInvalidElementName() throws Exception { 56 performAction("InvalidElementName.xml", 0); 57 } 58 59 60 public void testInaccessbleDTD() throws Exception { 61 performAction("InaccessbleDTD.xml", new int[] {3}); 62 } 63 64 66 67 public void testDistributedDTD() throws Exception { 68 performAction("DistributedDTD.xml", 0); 69 } 70 71 73 74 protected QaIOReporter performAction(Node[] nodes) { 75 if ((nodes == null) || (nodes.length == 0)) 76 fail("Ileegal argumet 'null'"); 77 78 QaIOReporter reporter = new QaIOReporter(); 79 for (int i = 0; i<nodes.length; i++) { 80 CheckXMLCookie cake = (CheckXMLCookie) nodes[i].getCookie(CheckXMLCookie.class); 81 if (cake == null) fail("Cannot get 'ValidateXMLCookie'.");; 82 cake.checkXML(reporter); 83 } 84 return reporter; 85 } 86 87 89 93 public static void main(String args[]) { 94 TestRunner.run(CheckActionTest.class); 95 } 96 } 97 | Popular Tags |