Skip to content

Commit 225d670

Browse files
committed
Add passing test for #219, mark as fixed (as of 2.10.4, post-dated)
1 parent be1723b commit 225d670

File tree

3 files changed

+72
-1
lines changed

3 files changed

+72
-1
lines changed

release-notes/VERSION-2.x

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,15 @@ Project: jackson-dataformat-xml
44
= Releases
55
------------------------------------------------------------------------
66

7+
2.10.5 (not yet released)
8+
9+
-
10+
711
2.10.4 (03-May-2020)
812

13+
#219: Deserialization issue from XML to POJO with Jackson: no String-argument
14+
constructor/factory method to deserialize from String value
15+
(NOTE: likely fixed earlier, but fix verified after 2.10.4 release)
916
- Upgrade Woodstox dependency to 6.2.0 (minor improvement to MSV shading)
1017

1118
2.10.3 (03-Mar-2020)

src/test/java/com/fasterxml/jackson/dataformat/xml/deser/TestDeserialization.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public void testMapWithAttr() throws Exception
6868
assertNotNull(map);
6969
}
7070

71-
// // Tests for [Issue#64]
71+
// // Tests for [dataformat-xml#64]
7272

7373
public void testOptionalAttr() throws Exception
7474
{
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package com.fasterxml.jackson.dataformat.xml.deser;
2+
3+
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
4+
import com.fasterxml.jackson.dataformat.xml.XmlTestBase;
5+
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
6+
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
7+
8+
public class TestDeserialization219 extends XmlTestBase
9+
{
10+
// [dataformat-xml#219]
11+
static class Worker219
12+
{
13+
@JacksonXmlProperty(localName = "developer")
14+
String developer;
15+
@JacksonXmlProperty(localName = "tester")
16+
String tester;
17+
@JacksonXmlProperty(localName = "manager")
18+
String manager;
19+
}
20+
21+
// [dataformat-xml#219]
22+
@JacksonXmlRootElement(localName="line")
23+
static class Line219 {
24+
public String code; //This should ideally be complex type
25+
public String amount;
26+
}
27+
28+
/*
29+
/**********************************************************
30+
/* Test methods
31+
/**********************************************************
32+
*/
33+
34+
private final XmlMapper MAPPER = newMapper();
35+
36+
// [dataformat-xml#219]
37+
public void testWithAttribute219Worker() throws Exception
38+
{
39+
final String DOC =
40+
"<worker>\n" +
41+
" <developer>test1</developer>\n" +
42+
" <tester grade='senior'>test2</tester>\n" +
43+
" <manager>test3</manager>\n" +
44+
"</worker>"
45+
;
46+
Worker219 result = MAPPER.readValue(DOC, Worker219.class);
47+
assertNotNull(result);
48+
assertEquals("test3", result.manager);
49+
}
50+
51+
// [dataformat-xml#219]
52+
public void testWithAttribute219Line() throws Exception
53+
{
54+
final String DOC =
55+
"<line>\n" +
56+
" <code type='ABC'>qsd</code>\n" +
57+
" <amount>138</amount>\n" +
58+
"</line>"
59+
;
60+
Line219 result = MAPPER.readValue(DOC, Line219.class);
61+
assertNotNull(result);
62+
assertEquals("138", result.amount);
63+
}
64+
}

0 commit comments

Comments
 (0)