-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
90aeb43
commit e6f871b
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
src/test-jdk14/java/com/fasterxml/jackson/databind/records/RecordNamingStrategy2992Test.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,25 @@ | ||
package com.fasterxml.jackson.databind.records; | ||
|
||
import com.fasterxml.jackson.databind.BaseMapTest; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.databind.PropertyNamingStrategies; | ||
import com.fasterxml.jackson.databind.annotation.JsonNaming; | ||
|
||
public class RecordNamingStrategy2992Test extends BaseMapTest | ||
{ | ||
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) | ||
record Record2992(String myId, String myValue) {} | ||
|
||
private final ObjectMapper MAPPER = newJsonMapper(); | ||
|
||
// [databind#2992] | ||
public void testRecordRenaming2992() throws Exception | ||
{ | ||
Record2992 src = new Record2992("id", "value"); | ||
String json = MAPPER.writeValueAsString(src); | ||
assertEquals(a2q("{'my_id':'id','my_value':'value'}"), json); | ||
Record2992 after = MAPPER.readValue(json, Record2992.class); | ||
assertEquals(src.myId(), after.myId()); | ||
assertEquals(src.myValue(), after.myValue()); | ||
} | ||
} |