Skip to content

Commit 1876ea8

Browse files
committed
Add passing test for #301
1 parent f1f314d commit 1876ea8

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

parameter-names/src/test/java/com/fasterxml/jackson/module/paramnames/JsonCreatorTest.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.fasterxml.jackson.databind.*;
55
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
66

7+
import static org.junit.Assert.assertEquals;
78
import static org.junit.Assert.assertNotNull;
89

910
import org.junit.*;
@@ -38,6 +39,20 @@ public Bean178(@JsonDeserialize() int a, int b) {
3839
}
3940
}
4041

42+
// [modules-base#301]
43+
static class Bean301
44+
{
45+
int _a, _b, _c;
46+
47+
public Bean301(@JsonProperty(required=true) int a,
48+
@JsonProperty(value="", required=false) int b,
49+
int c) {
50+
_a = a;
51+
_b = b;
52+
_c = c;
53+
}
54+
}
55+
4156
private final ObjectMapper MAPPER = newMapper();
4257

4358
@Test
@@ -57,4 +72,15 @@ public void testJsonCreatorWithOtherAnnotations() throws Exception
5772
Bean178 bean = MAPPER.readValue(a2q("{'a':1,'b':2}"), Bean178.class);
5873
assertNotNull(bean);
5974
}
75+
76+
// [modules-base#301]
77+
@Test
78+
public void testCreatorNameMasking310() throws Exception
79+
{
80+
Bean301 bean = MAPPER.readValue(a2q("{'a':1,'b':2, 'c':3}"), Bean301.class);
81+
assertNotNull(bean);
82+
assertEquals(1, bean._a);
83+
assertEquals(2, bean._b);
84+
assertEquals(3, bean._c);
85+
}
6086
}

0 commit comments

Comments
 (0)