[jboss-dev-forums] [Design of JBossXB] - XmlElementWrapper tests

alex.loubyansky@jboss.com do-not-reply at jboss.com
Wed Mar 5 11:25:27 EST 2008


Adrian, I fixed the bug you showed me yesterday. Here is the issue http://jira.jboss.com/jira/browse/JBXB-126

Adding the test for it, I found that the XML for current XmlElementWrapper tests doesn't look right to me. E.g. for class
@XmlRootElement
  | public class Foo2
  | {
  |    private List<Number> items;
  | 
  |    public List<Number> getItems()
  |    {
  |       return items;
  |    }
  | 
  |    @XmlElementWrapper(name="bar")
  |    @XmlElements({
  |       @XmlElement(name="int", required=false, type=Integer.class),
  |       @XmlElement(name="float", required=false, type=Float.class),
  |       @XmlElement(name="x", required=false, type=MyNumber.class)
  |    })
  |    public void setItems(List<Number> items)
  |    {
  |       this.items = items;
  |    }
  | }

the xml is
<foo2>
  |   <bar>
  |     <int>1</int>
  |   </bar>
  |   <bar>
  |     <int>2</int>    
  |   </bar>
  |   <bar>
  |     <float>1.1</float>    
  |   </bar>
  |   <bar>
  |     <x>123456789</x>
  |   </bar>
  | </foo2>

while I would expect it to be
<foo2>
  |   <bar>
  |     <int>1</int>
  |     <int>2</int>    
  |     <float>1.1</float>    
  |     <x>123456789</x>
  |   </bar>
  | </foo2>

In fact, both pass. As well as something like
<foo2>
  |   <bar>
  |     <int>1</int>
  |     <int>2</int>
  |   </bar>
  |   <bar>
  |     <float>1.1</float>    
  |   </bar>
  |   <bar>
  |     <x>123456789</x>
  |   </bar>
  | </foo2>

Because, I guess, all the particles are added as repeatable. But I don't think this is the way it is supposed to be.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134327#4134327

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4134327



More information about the jboss-dev-forums mailing list