[Jboss-cvs] JBossAS SVN: r57026 - trunk/testsuite/src/main/org/jboss/test/xml
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Sep 20 16:14:06 EDT 2006
Author: alex.loubyansky at jboss.com
Date: 2006-09-20 16:14:04 -0400 (Wed, 20 Sep 2006)
New Revision: 57026
Modified:
trunk/testsuite/src/main/org/jboss/test/xml/RepeatableTermsUnitTestCase.java
Log:
more tests
Modified: trunk/testsuite/src/main/org/jboss/test/xml/RepeatableTermsUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/xml/RepeatableTermsUnitTestCase.java 2006-09-20 20:13:34 UTC (rev 57025)
+++ trunk/testsuite/src/main/org/jboss/test/xml/RepeatableTermsUnitTestCase.java 2006-09-20 20:14:04 UTC (rev 57026)
@@ -34,7 +34,7 @@
*/
public class RepeatableTermsUnitTestCase
extends AbstractJBossXBTest
-{
+{
public RepeatableTermsUnitTestCase(String name)
{
super(name);
@@ -47,15 +47,10 @@
//enableTrace("org.jboss.xb.binding.sunday.unmarshalling.ChoiceBinding");
}
- public void testUnmarshal() throws Exception
+ public void testUnmarshal1() throws Exception
{
- String testXsd = findXML(rootName + ".xsd");
- SchemaBinding schema = XsdBinder.bind(testXsd, (SchemaBindingResolver)null);
- schema.setIgnoreUnresolvedFieldOrClass(false);
+ Object o = unmarshal();
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- Object o = unmarshaller.unmarshal(findXML(rootName + ".xml"), schema);
-
assertNotNull(o);
assertTrue(o instanceof Top);
Top top = (Top)o;
@@ -91,6 +86,31 @@
);
}
+ public void testUnmarshal2() throws Exception
+ {
+ Object o = unmarshal();
+ assertNotNull(o);
+ assertTrue(o instanceof Top);
+ Top top = (Top)o;
+
+ assertNull(top.item);
+ assertNull(top.choice);
+ assertNull(top.sequence);
+
+ assertEquals("item1", top.item1);
+ assertEquals("item2", top.item2);
+ }
+
+ private Object unmarshal() throws Exception
+ {
+ String testXsd = findXML(rootName + "_" + getName() + ".xsd");
+ SchemaBinding schema = XsdBinder.bind(testXsd, (SchemaBindingResolver)null);
+ schema.setIgnoreUnresolvedFieldOrClass(false);
+
+ Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ return unmarshaller.unmarshal(findXML(rootName + "_" + getName() + ".xml"), schema);
+ }
+
// Inner
public static final class Top
@@ -99,11 +119,15 @@
public Sequence[] sequence;
public Choice[] choice;
+ public String item1;
+ public String item2;
+
public String toString()
{
return "[top item=" + (item == null ? null : Arrays.asList(item)) +
" sequence=" + (sequence == null ? null : Arrays.asList(sequence)) +
- " choice=" + (choice == null ? null : Arrays.asList(choice)) + "]";
+ " choice=" + (choice == null ? null : Arrays.asList(choice)) +
+ " item1=" + item1 + " item2=" + item2 + "]";
}
}
More information about the jboss-cvs-commits
mailing list