Author: scabanovich
Date: 2011-10-07 16:39:11 -0400 (Fri, 07 Oct 2011)
New Revision: 35483
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/src/org/jboss/tools/cdi/seam/config/core/test/ParserTest.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/src/org/jboss/tools/cdi/seam/config/core/test/CDISeamConfigCoreAllTests.java
Log:
JBIDE-9855
https://issues.jboss.org/browse/JBIDE-9855
Test added to seam config parser.
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/src/org/jboss/tools/cdi/seam/config/core/test/CDISeamConfigCoreAllTests.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/src/org/jboss/tools/cdi/seam/config/core/test/CDISeamConfigCoreAllTests.java 2011-10-07
20:38:21 UTC (rev 35482)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/src/org/jboss/tools/cdi/seam/config/core/test/CDISeamConfigCoreAllTests.java 2011-10-07
20:39:11 UTC (rev 35483)
@@ -38,6 +38,7 @@
TestSuite suite31 = new TestSuite("CDI Config Core 3.1 Tests");
TestSuite suiteCore = new TestSuite("CDI Config Model Tests");
+ suiteCore.addTestSuite(ParserTest.class);
suiteCore.addTestSuite(ExtensionTest.class);
suiteCore.addTestSuite(SeamDefinitionsTest.class);
suiteCore.addTestSuite(SeamBeansTest.class);
@@ -48,10 +49,10 @@
suiteValidation.addTestSuite(SeamConfigValidationTest.class);
suite31.addTest(new SeamConfigValidationTestSetup(suiteValidation));
+ suiteAll.addTest(suite31);
+
suiteAll.addTestSuite(ValidationExceptionTest.class); // This test should be added
last!
- suiteAll.addTest(suite31);
-
return suiteAll;
}
}
\ No newline at end of file
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/src/org/jboss/tools/cdi/seam/config/core/test/ParserTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/src/org/jboss/tools/cdi/seam/config/core/test/ParserTest.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/src/org/jboss/tools/cdi/seam/config/core/test/ParserTest.java 2011-10-07
20:39:11 UTC (rev 35483)
@@ -0,0 +1,34 @@
+package org.jboss.tools.cdi.seam.config.core.test;
+
+import java.io.ByteArrayInputStream;
+
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocument;
+import org.jboss.tools.cdi.seam.config.core.xml.SAXElement;
+import org.jboss.tools.cdi.seam.config.core.xml.SAXParser;
+
+import junit.framework.TestCase;
+
+public class ParserTest extends TestCase {
+
+ public void testIncorrectXML() throws Exception {
+ String text = "<?xml version=\"1.0\"
encoding=\"UTF-8\"?>\n</";
+ IDocument document = new Document();
+ document.set(text);
+
+ SAXParser parser = new SAXParser();
+ parser.setSupperssedFatalErrorLimit(11);
+ ByteArrayInputStream s = new ByteArrayInputStream(text.getBytes());
+ SAXElement root = parser.parse(s, document);
+ assertEquals(12, parser.getErrors().size());
+
+ parser = new SAXParser();
+ parser.setSupperssedFatalErrorLimit(0);
+ s = new ByteArrayInputStream(text.getBytes());
+ root = parser.parse(s, document);
+ assertEquals(1, parser.getErrors().size());
+
+
+ }
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/src/org/jboss/tools/cdi/seam/config/core/test/ParserTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain