From 764c97ae1e691a53d2612dae15973489e0d25d60 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Sat, 26 Dec 2015 11:38:45 -0800 Subject: [PATCH] Minor fix to keep #86 test case working properly (failing for real reason, as opposed to failing due to missing test method) --- .../failing/TestUnwrappedDeserIssue86.java | 85 +++++++++---------- 1 file changed, 39 insertions(+), 46 deletions(-) diff --git a/src/test/java/com/fasterxml/jackson/dataformat/xml/failing/TestUnwrappedDeserIssue86.java b/src/test/java/com/fasterxml/jackson/dataformat/xml/failing/TestUnwrappedDeserIssue86.java index b9f9d34a9..89d038638 100644 --- a/src/test/java/com/fasterxml/jackson/dataformat/xml/failing/TestUnwrappedDeserIssue86.java +++ b/src/test/java/com/fasterxml/jackson/dataformat/xml/failing/TestUnwrappedDeserIssue86.java @@ -3,8 +3,6 @@ import java.util.Arrays; import java.util.List; -import org.junit.Test; - import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.dataformat.xml.XmlMapper; import com.fasterxml.jackson.dataformat.xml.XmlTestBase; @@ -18,11 +16,11 @@ public class TestUnwrappedDeserIssue86 extends XmlTestBase public static class Issue86 { @JacksonXmlProperty(localName = "id", isAttribute = true) - private String id; + public String id; @JacksonXmlElementWrapper(useWrapping = false) @JacksonXmlProperty(localName = "test") - private List children; + public List children; public Issue86() {} @@ -33,20 +31,15 @@ public Issue86(final String id, final List children) { @Override public boolean equals(final Object other) { - if (other == null) { - return false; - } - - if (other == this) { - return true; - } + if (other == this) return true; + if (other == null) return false; - if (!(other instanceof Issue86)) { - return false; - } + if (!(other instanceof Issue86)) { + return false; + } - final Issue86 otherIssue86 = (Issue86) other; - return otherIssue86.id.equals(id) && otherIssue86.children.equals(children); + final Issue86 otherIssue86 = (Issue86) other; + return otherIssue86.id.equals(id) && otherIssue86.children.equals(children); } } @@ -56,34 +49,34 @@ public boolean equals(final Object other) { /*********************************************************************** */ - @Test - public void deserializeUnwrappedListWhenLocalNameForRootElementAndXmlPropertyMatch() throws Exception { - final String source = - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - ""; - - final Issue86 before = new Issue86("0", - Arrays.asList(new Issue86("0.1", - Arrays.asList(new Issue86("0.1.1", null))), - new Issue86("0.2", null), - new Issue86("0.3", - Arrays.asList( - new Issue86("0.3.1", null))))); - - final XmlMapper mapper = new XmlMapper(); - mapper.setSerializationInclusion(Include.NON_NULL); - - final String xml = mapper.writeValueAsString(before); - assertEquals(source, xml); - - final Issue86 after = mapper.readValue(xml, Issue86.class); - assertEquals(before, after); - } + public void testDeserializeUnwrappedListWhenLocalNameForRootElementAndXmlPropertyMatch() throws Exception + { + final String source = + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + ""; + + final Issue86 before = new Issue86("0", + Arrays.asList(new Issue86("0.1", + Arrays.asList(new Issue86("0.1.1", null))), + new Issue86("0.2", null), + new Issue86("0.3", + Arrays.asList( + new Issue86("0.3.1", null))))); + + final XmlMapper mapper = new XmlMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + + final String xml = mapper.writeValueAsString(before); + assertEquals(source, xml); + + final Issue86 after = mapper.readValue(xml, Issue86.class); + assertEquals(before, after); + } }