File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
src/test-jdk17/java/com/fasterxml/jackson/databind/jdk17 Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .fasterxml .jackson .databind .jdk17 ;
2+
3+ import java .util .Collections ;
4+
5+ import com .fasterxml .jackson .databind .BaseMapTest ;
6+ import com .fasterxml .jackson .databind .ObjectMapper ;
7+
8+ // for [databind#4175]
9+ public class RecordPrivate4175Test extends BaseMapTest
10+ {
11+ private static record PrivateTextRecord4175 (String text ) { }
12+
13+ private final ObjectMapper MAPPER = newJsonMapper ();
14+
15+ // for [databind#4175]
16+ public void testSerializePrivateTextRecord () throws Exception {
17+ PrivateTextRecord4175 textRecord = new PrivateTextRecord4175 ("anything" );
18+ String json = MAPPER .writeValueAsString (textRecord );
19+ final Object EXP = Collections .singletonMap ("text" , "anything" );
20+ assertEquals (EXP , MAPPER .readValue (json , Object .class ));
21+ }
22+
23+ public void testDeserializePrivateTextRecord () throws Exception {
24+ assertEquals (new PrivateTextRecord4175 ("anything" ),
25+ MAPPER .readValue ("{\" text\" :\" anything\" }" , PrivateTextRecord4175 .class ));
26+ }
27+ }
You can’t perform that action at this time.
0 commit comments