File tree 1 file changed +25
-0
lines changed
src/test-jdk14/java/com/fasterxml/jackson/databind/records
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .databind .records ;
2
+
3
+ import com .fasterxml .jackson .databind .BaseMapTest ;
4
+ import com .fasterxml .jackson .databind .ObjectMapper ;
5
+ import com .fasterxml .jackson .databind .PropertyNamingStrategies ;
6
+ import com .fasterxml .jackson .databind .annotation .JsonNaming ;
7
+
8
+ public class RecordNamingStrategy2992Test extends BaseMapTest
9
+ {
10
+ @ JsonNaming (PropertyNamingStrategies .SnakeCaseStrategy .class )
11
+ record Record2992 (String myId , String myValue ) {}
12
+
13
+ private final ObjectMapper MAPPER = newJsonMapper ();
14
+
15
+ // [databind#2992]
16
+ public void testRecordRenaming2992 () throws Exception
17
+ {
18
+ Record2992 src = new Record2992 ("id" , "value" );
19
+ String json = MAPPER .writeValueAsString (src );
20
+ assertEquals (a2q ("{'my_id':'id','my_value':'value'}" ), json );
21
+ Record2992 after = MAPPER .readValue (json , Record2992 .class );
22
+ assertEquals (src .myId (), after .myId ());
23
+ assertEquals (src .myValue (), after .myValue ());
24
+ }
25
+ }
You can’t perform that action at this time.
0 commit comments