Skip to content

Commit 764c97a

Browse files
committed
Minor fix to keep #86 test case working properly (failing for real reason, as opposed to failing due to missing test method)
1 parent d728897 commit 764c97a

File tree

1 file changed

+39
-46
lines changed

1 file changed

+39
-46
lines changed

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

+39-46
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import java.util.Arrays;
44
import java.util.List;
55

6-
import org.junit.Test;
7-
86
import com.fasterxml.jackson.annotation.JsonInclude.Include;
97
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
108
import com.fasterxml.jackson.dataformat.xml.XmlTestBase;
@@ -18,11 +16,11 @@ public class TestUnwrappedDeserIssue86 extends XmlTestBase
1816
public static class Issue86 {
1917

2018
@JacksonXmlProperty(localName = "id", isAttribute = true)
21-
private String id;
19+
public String id;
2220

2321
@JacksonXmlElementWrapper(useWrapping = false)
2422
@JacksonXmlProperty(localName = "test")
25-
private List<Issue86> children;
23+
public List<Issue86> children;
2624

2725
public Issue86() {}
2826

@@ -33,20 +31,15 @@ public Issue86(final String id, final List<Issue86> children) {
3331

3432
@Override
3533
public boolean equals(final Object other) {
36-
if (other == null) {
37-
return false;
38-
}
39-
40-
if (other == this) {
41-
return true;
42-
}
34+
if (other == this) return true;
35+
if (other == null) return false;
4336

44-
if (!(other instanceof Issue86)) {
45-
return false;
46-
}
37+
if (!(other instanceof Issue86)) {
38+
return false;
39+
}
4740

48-
final Issue86 otherIssue86 = (Issue86) other;
49-
return otherIssue86.id.equals(id) && otherIssue86.children.equals(children);
41+
final Issue86 otherIssue86 = (Issue86) other;
42+
return otherIssue86.id.equals(id) && otherIssue86.children.equals(children);
5043
}
5144
}
5245

@@ -56,34 +49,34 @@ public boolean equals(final Object other) {
5649
/***********************************************************************
5750
*/
5851

59-
@Test
60-
public void deserializeUnwrappedListWhenLocalNameForRootElementAndXmlPropertyMatch() throws Exception {
61-
final String source =
62-
"<test id=\"0\">" +
63-
"<test id=\"0.1\">" +
64-
"<test id=\"0.1.1\"/>" +
65-
"</test>" +
66-
"<test id=\"0.2\"/>" +
67-
"<test id=\"0.3\">" +
68-
"<test id=\"0.3.1\"/>" +
69-
"</test>" +
70-
"</test>";
71-
72-
final Issue86 before = new Issue86("0",
73-
Arrays.asList(new Issue86("0.1",
74-
Arrays.asList(new Issue86("0.1.1", null))),
75-
new Issue86("0.2", null),
76-
new Issue86("0.3",
77-
Arrays.asList(
78-
new Issue86("0.3.1", null)))));
79-
80-
final XmlMapper mapper = new XmlMapper();
81-
mapper.setSerializationInclusion(Include.NON_NULL);
82-
83-
final String xml = mapper.writeValueAsString(before);
84-
assertEquals(source, xml);
85-
86-
final Issue86 after = mapper.readValue(xml, Issue86.class);
87-
assertEquals(before, after);
88-
}
52+
public void testDeserializeUnwrappedListWhenLocalNameForRootElementAndXmlPropertyMatch() throws Exception
53+
{
54+
final String source =
55+
"<test id=\"0\">" +
56+
"<test id=\"0.1\">" +
57+
"<test id=\"0.1.1\"/>" +
58+
"</test>" +
59+
"<test id=\"0.2\"/>" +
60+
"<test id=\"0.3\">" +
61+
"<test id=\"0.3.1\"/>" +
62+
"</test>" +
63+
"</test>";
64+
65+
final Issue86 before = new Issue86("0",
66+
Arrays.asList(new Issue86("0.1",
67+
Arrays.asList(new Issue86("0.1.1", null))),
68+
new Issue86("0.2", null),
69+
new Issue86("0.3",
70+
Arrays.asList(
71+
new Issue86("0.3.1", null)))));
72+
73+
final XmlMapper mapper = new XmlMapper();
74+
mapper.setSerializationInclusion(Include.NON_NULL);
75+
76+
final String xml = mapper.writeValueAsString(before);
77+
assertEquals(source, xml);
78+
79+
final Issue86 after = mapper.readValue(xml, Issue86.class);
80+
assertEquals(before, after);
81+
}
8982
}

0 commit comments

Comments
 (0)