You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ve...@apache.org on 2008/12/16 13:40:54 UTC
svn commit: r727041 -
/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDocumentTest.java
Author: veithen
Date: Tue Dec 16 04:40:54 2008
New Revision: 727041
URL: http://svn.apache.org/viewvc?rev=727041&view=rev
Log:
Added a test case that checks that Axiom correctly reports errors for malformed documents. This provides regression testing for WSCOMMONS-121, WSCOMMONS-323 and WSCOMMONS-372.
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDocumentTest.java
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDocumentTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDocumentTest.java?rev=727041&r1=727040&r2=727041&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDocumentTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDocumentTest.java Tue Dec 16 04:40:54 2008
@@ -70,6 +70,19 @@
}
+ /**
+ * Test that a document that is not well formed triggers an appropriate error.
+ */
+ public void testMalformedDocument() {
+ OMDocument document = getSampleOMDocument("<Root><Child attr='a' attr='a'/></Root>");
+ try {
+ document.serialize(new ByteArrayOutputStream());
+ fail("Expected exception");
+ } catch (Exception ex) {
+ // We expect an exception here
+ }
+ }
+
private OMDocument getSampleOMDocument(String xml) {
try {
XMLStreamReader xmlStreamReader =