Skip to content

Commit b1ac58b

Browse files
authored
Add a test to show #508 fixed (#751)
1 parent 361d2ff commit b1ac58b

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

release-notes/VERSION-2.x

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Project: jackson-dataformat-xml
44
=== Releases ===
55
------------------------------------------------------------------------
66

7+
#508: `XmlMapper` is unable to deserialise into an empty record
8+
(reported by @protazy)
79
#745: Add feature to include `standalone='yes'` in xml declaration
810
(contributed by @duoduobingbing)
911

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.fasterxml.jackson.dataformat.xml.records;
2+
3+
import org.junit.jupiter.api.Test;
4+
5+
import com.fasterxml.jackson.dataformat.xml.*;
6+
7+
import static org.junit.jupiter.api.Assertions.assertNotNull;
8+
9+
// [dataformat-xml#508]
10+
public class XmlEmptyRecordDeser508Test extends XmlTestUtil
11+
{
12+
static class EmptyClass508 {
13+
}
14+
15+
public record EmptyRecord508() {
16+
}
17+
18+
private final XmlMapper MAPPER = new XmlMapper();
19+
20+
@Test
21+
public void testEmptyPOJO() throws Exception {
22+
assertNotNull(MAPPER.readValue("<EmptyClass508/>", EmptyClass508.class));
23+
}
24+
25+
@Test
26+
public void testEmptyRecord() throws Exception {
27+
assertNotNull(MAPPER.readValue("<EmptyRecord508/>", EmptyRecord508.class));
28+
}
29+
}

0 commit comments

Comments
 (0)