Skip to content

Commit 30ccb47

Browse files
committed
Addition to #736 test
1 parent e003de0 commit 30ccb47

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

src/test-jdk17/java/com/fasterxml/jackson/dataformat/xml/records/tofix/XmlRecordDeser735Test.java

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,34 @@ public class XmlRecordDeser735Test extends XmlTestUtil
1515
record Amount(@JacksonXmlText String value,
1616
@JacksonXmlProperty(isAttribute = true, localName = "Ccy") String currency) {}
1717

18-
private final String XML =
19-
a2q("<Amt Ccy='EUR'>1</Amt>");
18+
static class Pojo735 {
19+
String value;
20+
String currency;
21+
22+
public Pojo735(@JacksonXmlText String value,
23+
@JacksonXmlProperty(isAttribute = true, localName = "Ccy") String currency)
24+
{
25+
this.value = value;
26+
this.currency = currency;
27+
}
28+
}
29+
30+
private final String XML = "<Amt Ccy='EUR'>1</Amt>";
31+
32+
private final XmlMapper MAPPER = newMapper();
33+
34+
@JacksonTestFailureExpected
35+
@Test
36+
public void testPojoDeser() throws Exception {
37+
Pojo735 amt = MAPPER.readValue(XML, Pojo735.class);
38+
assertEquals("1", amt.value);
39+
assertEquals("EUR", amt.currency);
40+
}
2041

2142
@JacksonTestFailureExpected
2243
@Test
23-
public void testDeser() throws Exception {
24-
XmlMapper mapper = new XmlMapper();
25-
Amount amt = mapper.readValue(XML, Amount.class);
44+
public void testRecordDeser() throws Exception {
45+
Amount amt = MAPPER.readValue(XML, Amount.class);
2646
assertEquals("1", amt.value);
2747
assertEquals("EUR", amt.currency);
2848
}

src/test/java/com/fasterxml/jackson/dataformat/xml/tofix/XmlTextViaCreator306Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import static org.junit.jupiter.api.Assertions.assertEquals;
1717
import static org.junit.jupiter.api.Assertions.assertNotNull;
1818

19-
// [dataformat-xml#306]: Problem is that `@XmlText` has no nominal property name
19+
// [dataformat-xml#306]: Problem is that `@XmlText` has the nominal property name
2020
// of empty String (""), and that is not properly bound. Worse, empty String has
2121
// special meaning so that annotation CANNOT specify it, either.
2222
public class XmlTextViaCreator306Test extends XmlTestUtil

0 commit comments

Comments
 (0)