Skip to content

Commit 4d4e09b

Browse files
committed
Add a note on work-around for failing test #124
1 parent 0d451e6 commit 4d4e09b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/test/java/com/fasterxml/jackson/dataformat/xml/failing/EmptyListDeser124Test.java

+12-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import java.util.List;
55

66
import com.fasterxml.jackson.annotation.JsonProperty;
7+
import com.fasterxml.jackson.annotation.JsonSetter;
8+
import com.fasterxml.jackson.annotation.Nulls;
79
import com.fasterxml.jackson.dataformat.xml.*;
810

911
// for [dataformat-xml#124]
@@ -16,11 +18,19 @@ public static class TestList {
1618

1719
// [dataformat-xml#124]
1820
public void test124() throws Exception {
19-
final XmlMapper xmlMapper = new XmlMapper();
21+
final XmlMapper xmlMapper = XmlMapper.builder()
22+
.build();
23+
24+
// 14-Jan-2020, tatu: This is actual working override to resolve the issue...
25+
// Not sure if this can be otherwise resolved.
26+
27+
// xmlMapper.configOverride(List.class)
28+
// .setSetterInfo(JsonSetter.Value.forValueNulls(Nulls.AS_EMPTY));
29+
2030
TestList originalObject = new TestList();
2131
originalObject.list = new ArrayList<Object>();
2232
String xml = xmlMapper.writeValueAsString(originalObject);
23-
//System.err.println(xml); // print <TestList><list/>></TestList>
33+
//System.err.println(xml); // prints <TestList><list/>></TestList>
2434

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

0 commit comments

Comments
 (0)