Skip to content

Commit e6f871b

Browse files
committed
Add failing test for #2992
1 parent 90aeb43 commit e6f871b

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
}

0 commit comments

Comments
 (0)