Skip to content

Commit

Permalink
Merge branch '2.17' into 2.18
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Oct 10, 2024
2 parents 61ec153 + 57974d2 commit c262e76
Showing 1 changed file with 32 additions and 0 deletions.
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);
}

}

0 comments on commit c262e76

Please sign in to comment.