Skip to content

Commit eeb4fdd

Browse files
authored
Add failing test (#4693)
1 parent 8e277e9 commit eeb4fdd

File tree

1 file changed

+30
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)