Skip to content

Commit

Permalink
Add passing test for #301
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Feb 4, 2024
1 parent f1f314d commit 1876ea8
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand Down Expand Up @@ -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
Expand All @@ -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);
}
}

0 comments on commit 1876ea8

Please sign in to comment.