package com.fasterxml.jackson.dataformat.xml.lists;

import java.util.*;

import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import com.fasterxml.jackson.dataformat.xml.XmlTestBase;
import com.fasterxml.jackson.dataformat.xml.annotation.*;

// Failing unit test(s) wrt [Issue#64]
public class TestUnwrappedLists extends XmlTestBase
{
    static class Optional {
        @JacksonXmlText
        public String number = "NOT SET";

        @JacksonXmlProperty(isAttribute=true)
        public String type = "NOT SET";

        public Optional() { }
        
        // uncommenting this ALSO works:
//        public Optional(String n) { number = n; }
    }

    static class Optionals {
        @JacksonXmlElementWrapper(useWrapping = false)
        public List<Optional> optional;
    } 

    /*
    /**********************************************************
    /* Unit tests
    /**********************************************************
     */

    private final XmlMapper MAPPER = new XmlMapper();

    // // [Issue#64]
    public void testOptionalsWithMissingType() throws Exception
    {
//        Optionals ob = MAPPER.readValue("<MultiOptional><optional type='work'>123-456-7890</optional></MultiOptional>",
        Optionals ob = MAPPER.readValue("<MultiOptional><optional>123-456-7890</optional></MultiOptional>",
                Optionals.class);
        assertNotNull(ob);
        assertNotNull(ob.optional);
        assertEquals(1, ob.optional.size());

//            System.err.println("ob: " + ob); // works fine

        Optional opt = ob.optional.get(0);
        assertEquals("123-456-7890", opt.number);
        assertEquals("NOT SET", opt.type);
    }
}
@@ -67,16 +67,75 @@
 til.*;%0A%0A
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;%0A
 import c
@@ -177,24 +177,24 @@
 .XmlMapper;%0A
-
 import com.f
@@ -843,16 +843,715 @@
     %7D %0A%0A
+    // For %5BIssue#101%5D%0A    @JacksonXmlRootElement(localName = %22root%22)    %0A    @JsonPropertyOrder(%7B %22unwrapped%22, %22name%22 %7D)%0A    static class Root %7B%0A        @JacksonXmlProperty(localName = %22unwrapped%22)%0A        @JacksonXmlElementWrapper(useWrapping = false)%0A        public List%3CUnwrappedElement%3E unwrapped;%0A%0A        public String name;%0A    %7D%0A%0A     static class UnwrappedElement %7B%0A        public UnwrappedElement () %7B%7D%0A%0A        public UnwrappedElement (String id, String type) %7B%0A            this.id = id;%0A            this.type = type;%0A        %7D%0A%0A        @JacksonXmlProperty(isAttribute = true)%0A        public String id;%0A%0A        @JacksonXmlProperty(isAttribute = true)%0A        public String type;%0A    %7D%0A%0A
     /*%0A 
@@ -2427,9 +2427,835 @@
 ;%0A    %7D%0A
-%7D
+%0A    // %5BIssue#101%5D%0A    public void testWithTwoAttributes() throws Exception%0A    %7B%0A        final String EXP = %22%3Croot%3E%22%0A                +%22%3Cunwrapped id=%5C%221%5C%22 type=%5C%22string%5C%22/%3E%22%0A                +%22%3Cunwrapped id=%5C%222%5C%22 type=%5C%22string%5C%22/%3E%22%0A                +%22%3Cname%3Etest%3C/name%3E%22%0A                +%22%3C/root%3E%22;%0A        Root rootOb = new Root();%0A        rootOb.unwrapped = Arrays.asList(%0A                new UnwrappedElement(%221%22, %22string%22),%0A                new UnwrappedElement(%222%22, %22string%22)%0A        );%0A        rootOb.name = %22test%22;%0A%0A        // First, serialize, which works%0A        String xml = MAPPER.writeValueAsString(rootOb);%0A        assertEquals(EXP, xml);%0A%0A        // then try deserialize%0A        Root result = MAPPER.readValue(xml, Root.class);%0A        assertNotNull(result);%0A        assertEquals(rootOb.name, result.name);%0A    %7D%0A%7D%0A

Add a unit test for #101