diff --git a/release-notes/VERSION-2.x b/release-notes/VERSION-2.x index 56d5dd3c..98a96b2f 100644 --- a/release-notes/VERSION-2.x +++ b/release-notes/VERSION-2.x @@ -4,6 +4,8 @@ Project: jackson-dataformat-xml === Releases === ------------------------------------------------------------------------ +#508: `XmlMapper` is unable to deserialise into an empty record + (reported by @protazy) #745: Add feature to include `standalone='yes'` in xml declaration (contributed by @duoduobingbing) diff --git a/src/test-jdk17/java/com/fasterxml/jackson/dataformat/xml/records/XmlEmptyRecordDeser508Test.java b/src/test-jdk17/java/com/fasterxml/jackson/dataformat/xml/records/XmlEmptyRecordDeser508Test.java new file mode 100644 index 00000000..1763deed --- /dev/null +++ b/src/test-jdk17/java/com/fasterxml/jackson/dataformat/xml/records/XmlEmptyRecordDeser508Test.java @@ -0,0 +1,29 @@ +package com.fasterxml.jackson.dataformat.xml.records; + +import org.junit.jupiter.api.Test; + +import com.fasterxml.jackson.dataformat.xml.*; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + +// [dataformat-xml#508] +public class XmlEmptyRecordDeser508Test extends XmlTestUtil +{ + static class EmptyClass508 { + } + + public record EmptyRecord508() { + } + + private final XmlMapper MAPPER = new XmlMapper(); + + @Test + public void testEmptyPOJO() throws Exception { + assertNotNull(MAPPER.readValue("", EmptyClass508.class)); + } + + @Test + public void testEmptyRecord() throws Exception { + assertNotNull(MAPPER.readValue("", EmptyRecord508.class)); + } +}