Skip to content

Commit

Permalink
Merge branch '2.17' into 2.18
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Sep 11, 2024
2 parents 04a6719 + eeb4fdd commit 97d37dd
Showing 1 changed file with 30 additions and 0 deletions.
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());
}

}

0 comments on commit 97d37dd

Please sign in to comment.