File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
src/test-jdk17/java/com/fasterxml/jackson/failing Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .fasterxml .jackson .failing ;
2+
3+ import com .fasterxml .jackson .databind .ObjectMapper ;
4+ import com .fasterxml .jackson .databind .testutil .DatabindTestUtil ;
5+ import org .junit .jupiter .api .Test ;
6+
7+ import static org .junit .jupiter .api .Assertions .assertEquals ;
8+ import static org .junit .jupiter .api .Assertions .assertNotNull ;
9+
10+ // [databind#4690] InvalidDefinitionException "No fallback setter/field defined for creator property"
11+ // when deserializing JSON with duplicated property to single-property Record
12+ public class DuplicatePropertyDeserializationRecord4690Test
13+ extends DatabindTestUtil
14+ {
15+
16+ record MyRecord (String first ) { }
17+
18+ private final ObjectMapper mapper = newJsonMapper ();
19+
20+ @ Test
21+ void testDuplicatePropertyDeserialization () throws Exception {
22+ final String json = a2q ("{'first':'value','first':'value2'}" );
23+
24+ MyRecord result = mapper .readValue (json , MyRecord .class );
25+
26+ assertNotNull (result );
27+ assertEquals ("value2" , result .first ());
28+ }
29+
30+ }
You can’t perform that action at this time.
0 commit comments