Skip to content

Commit

Permalink
Add failing test for #124
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jun 11, 2016
1 parent 37eb331 commit 0068fed
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.fasterxml.jackson.dataformat.xml.failing;

import java.util.ArrayList;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.dataformat.xml.*;

// for [dataformat-xml#124]
public class EmptyListDeser124Test extends XmlTestBase
{
public static class TestList {
@JsonProperty("list")
public List<Object> list;
}

// [dataformat-xml#124]
public void test124() throws Exception {
final XmlMapper xmlMapper = new XmlMapper();
TestList originalObject = new TestList();
originalObject.list = new ArrayList<Object>();
String xml = xmlMapper.writeValueAsString(originalObject);
//System.err.println(xml); // print <TestList><list/>></TestList>

TestList result = xmlMapper.readValue(xml, TestList.class);

assertNotNull(result.list);
assertEquals(0, result.list.size());
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.fasterxml.jackson.dataformat.xml.failing;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import com.fasterxml.jackson.dataformat.xml.XmlTestBase;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
Expand Down Expand Up @@ -79,4 +81,6 @@ public void testDeserializeUnwrappedListWhenLocalNameForRootElementAndXmlPropert
final Issue86 after = mapper.readValue(xml, Issue86.class);
assertEquals(before, after);
}


}

0 comments on commit 0068fed

Please sign in to comment.