-
-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add JDK 17 test functionality (#672)
- Loading branch information
1 parent
400de82
commit 57974d2
Showing
2 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/test-jdk17/java/com/fasterxml/jackson/dataformat/xml/jdk17/Java17CollectionsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<String> input = Stream.of("a", "b", "c").collect(Collectors.toList()); | ||
|
||
String ser = _xmlMapper.writeValueAsString(input); | ||
assertEquals("<ArrayList><item>a</item><item>b</item><item>c</item></ArrayList>", 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); | ||
} | ||
|
||
} |