-
-
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
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
...17/java/com/fasterxml/jackson/failing/DuplicatePropertyDeserializationRecord4690Test.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,30 @@ | ||
package com.fasterxml.jackson.failing; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.databind.testutil.DatabindTestUtil; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
// [databind#4690] InvalidDefinitionException "No fallback setter/field defined for creator property" | ||
// when deserializing JSON with duplicated property to single-property Record | ||
public class DuplicatePropertyDeserializationRecord4690Test | ||
extends DatabindTestUtil | ||
{ | ||
|
||
record MyRecord(String first) { } | ||
|
||
private final ObjectMapper mapper = newJsonMapper(); | ||
|
||
@Test | ||
void testDuplicatePropertyDeserialization() throws Exception { | ||
final String json = a2q("{'first':'value','first':'value2'}"); | ||
|
||
MyRecord result = mapper.readValue(json, MyRecord.class); | ||
|
||
assertNotNull(result); | ||
assertEquals("value2", result.first()); | ||
} | ||
|
||
} |