diff --git a/pom.xml b/pom.xml index 4702f8d1..9ee509ee 100644 --- a/pom.xml +++ b/pom.xml @@ -202,4 +202,58 @@ alternative support for serializing POJOs as XML and deserializing XML as pojos. + + + + java17 + + 17 + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + add-test-source + generate-test-sources + + add-test-source + + + + src/test-jdk17/java + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + true + + + 17 + 17 + + -parameters + --add-opens=java.base/java.lang=ALL-UNNAMED + --add-opens=java.base/java.util=ALL-UNNAMED + + + + + org.apache.maven.plugins + maven-surefire-plugin + + --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED + + + + + + + diff --git a/src/test-jdk17/java/com/fasterxml/jackson/dataformat/xml/jdk17/Java17CollectionsTest.java b/src/test-jdk17/java/com/fasterxml/jackson/dataformat/xml/jdk17/Java17CollectionsTest.java new file mode 100644 index 00000000..d7fa69db --- /dev/null +++ b/src/test-jdk17/java/com/fasterxml/jackson/dataformat/xml/jdk17/Java17CollectionsTest.java @@ -0,0 +1,32 @@ +package com.fasterxml.jackson.dataformat.xml.jdk17; + +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import com.fasterxml.jackson.dataformat.xml.XmlMapper; +import com.fasterxml.jackson.dataformat.xml.XmlTestBase; + +public class Java17CollectionsTest extends XmlTestBase +{ + + private final XmlMapper _xmlMapper = new XmlMapper(); + + public void testStreamOf() + throws Exception + { + List input = Stream.of("a", "b", "c").collect(Collectors.toList()); + + String ser = _xmlMapper.writeValueAsString(input); + assertEquals("abc", ser); + + List deser = _xmlMapper.readValue(ser, List.class); + assertEquals(input, deser); + + input = Stream.of("a", "b", "c").toList(); + ser = _xmlMapper.writeValueAsString(input); + deser = _xmlMapper.readValue(ser, List.class); + assertEquals(input, deser); + } + +}