From 1876ea82f326e05757d2a439af2b56290bb5d7c3 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Sat, 3 Feb 2024 18:09:52 -0800 Subject: [PATCH] Add passing test for #301 --- .../module/paramnames/JsonCreatorTest.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/parameter-names/src/test/java/com/fasterxml/jackson/module/paramnames/JsonCreatorTest.java b/parameter-names/src/test/java/com/fasterxml/jackson/module/paramnames/JsonCreatorTest.java index a0033a47..ba525c96 100644 --- a/parameter-names/src/test/java/com/fasterxml/jackson/module/paramnames/JsonCreatorTest.java +++ b/parameter-names/src/test/java/com/fasterxml/jackson/module/paramnames/JsonCreatorTest.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import org.junit.*; @@ -38,6 +39,20 @@ public Bean178(@JsonDeserialize() int a, int b) { } } + // [modules-base#301] + static class Bean301 + { + int _a, _b, _c; + + public Bean301(@JsonProperty(required=true) int a, + @JsonProperty(value="", required=false) int b, + int c) { + _a = a; + _b = b; + _c = c; + } + } + private final ObjectMapper MAPPER = newMapper(); @Test @@ -57,4 +72,15 @@ public void testJsonCreatorWithOtherAnnotations() throws Exception Bean178 bean = MAPPER.readValue(a2q("{'a':1,'b':2}"), Bean178.class); assertNotNull(bean); } + + // [modules-base#301] + @Test + public void testCreatorNameMasking310() throws Exception + { + Bean301 bean = MAPPER.readValue(a2q("{'a':1,'b':2, 'c':3}"), Bean301.class); + assertNotNull(bean); + assertEquals(1, bean._a); + assertEquals(2, bean._b); + assertEquals(3, bean._c); + } }