You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by kk...@apache.org on 2004/09/22 20:15:36 UTC
cvs commit: xml-xmlbeans/v2/test/src/xmlobject/checkin AssortedTests.java
kkrouse 2004/09/22 11:15:36
Modified: v2/test/src/xmlobject/checkin AssortedTests.java
Log:
copying test from v1 over to v2.
asserts that no ClassCastException is thrown if the xsi:type is bad.
see rev 1.5 of v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeImpl.java
and rev 1.3 of v1/test/src/drt/drtcases/AssortedTests.java
Revision Changes Path
1.8 +31 -0 xml-xmlbeans/v2/test/src/xmlobject/checkin/AssortedTests.java
Index: AssortedTests.java
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/test/src/xmlobject/checkin/AssortedTests.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- AssortedTests.java 18 Aug 2004 15:25:53 -0000 1.7
+++ AssortedTests.java 22 Sep 2004 18:15:36 -0000 1.8
@@ -24,6 +24,7 @@
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlTime;
import com.easypo.XmlPurchaseOrderDocumentBean;
+import com.easypo.XmlCustomerBean;
import com.easypo.XmlLineItemBean;
import java.math.BigInteger;
@@ -118,6 +119,36 @@
Assert.assertEquals(BigInteger.valueOf(1), xdoc.getPurchaseOrder().getLineItemArray(0).getQuantity());
Assert.assertEquals(BigInteger.valueOf(200), xdoc.getPurchaseOrder().getLineItemArray(1).getQuantity());
Assert.assertEquals(BigInteger.valueOf(4), xdoc.getPurchaseOrder().getLineItemArray(2).getQuantity());
+ }
+
+ // bug 45338
+ public static void testComplexGetter() throws Exception
+ {
+ XmlPurchaseOrderDocumentBean xdoc =
+ XmlPurchaseOrderDocumentBean.Factory.parse(
+ "<purchase-order xmlns='http://openuri.org/easypo'" +
+ " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" +
+ " xsi:type='foo'>" +
+ "<customer xsi:type='bar'>" +
+ "<name>David Bau</name>" +
+ "<address>100 Main Street</address>" +
+ "</customer>" +
+ "<date>2003-05-18T11:50:00</date>" +
+ "<line-item>" +
+ "<description>Blue Candy</description>" +
+ "<per-unit-ounces>5.0</per-unit-ounces>" +
+ "<quantity>1</quantity>" +
+ "</line-item>" +
+ "</purchase-order>");
+
+ Assert.assertEquals(false, xdoc.validate());
+ Assert.assertEquals(XmlPurchaseOrderDocumentBean.type, xdoc.schemaType());
+
+ // check type of element when xsi:type is bad
+ XmlObject cust = xdoc.getPurchaseOrder().getCustomer();
+ Assert.assertEquals(XmlCustomerBean.type, cust.schemaType());
+
+ Assert.assertEquals("David Bau", ((XmlCustomerBean)cust).getName());
}
public static void donttestPrettyPrint() throws Exception
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: commits-help@xmlbeans.apache.org