|
9 | 9 |
|
10 | 10 | import java.util.List;
|
11 | 11 |
|
12 |
| -public class Issue1009Test extends BaseMapTest { |
13 |
| - |
14 |
| - public void testDeserialization() throws JsonProcessingException { |
15 |
| - String rawResponse = "{\"list\":[{\"type\":\"impl\",\"unmappedKey\":\"unusedValue\"}]}"; |
16 |
| - MyResponse myResponse = objectMapper().readValue(rawResponse, MyResponse.class); |
17 |
| - assertNotNull(myResponse); |
18 |
| - assertEquals(1, myResponse.list.size()); |
19 |
| - assertEquals("impl", myResponse.list.get(0).getType()); |
20 |
| - assertNull(myResponse.list.get(0).getMissingInJson()); |
21 |
| - } |
22 |
| - |
23 |
| - protected ObjectMapper objectMapper() { |
24 |
| - ObjectMapper om = new ObjectMapper(); |
25 |
| - om.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); |
26 |
| - return om; |
27 |
| - } |
28 |
| - |
| 12 | +public class Issue3913DeserTest extends BaseMapTest |
| 13 | +{ |
| 14 | + // [databind#3913] |
29 | 15 | static class MyResponse {
|
30 |
| - private List<Base> list; |
| 16 | + List<Base> list; |
31 | 17 |
|
32 | 18 | public List<Base> getList() {
|
33 | 19 | return list;
|
@@ -86,4 +72,17 @@ public void setMissingInJson(String missingInJson) {
|
86 | 72 | this.missingInJson = missingInJson;
|
87 | 73 | }
|
88 | 74 | }
|
| 75 | + |
| 76 | + // [databind#3913] |
| 77 | + public void testDeserialization() throws JsonProcessingException { |
| 78 | + ObjectMapper mapper = jsonMapperBuilder() |
| 79 | + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) |
| 80 | + .build(); |
| 81 | + String rawResponse = "{\"list\":[{\"type\":\"impl\",\"unmappedKey\":\"unusedValue\"}]}"; |
| 82 | + MyResponse myResponse = mapper.readValue(rawResponse, MyResponse.class); |
| 83 | + assertNotNull(myResponse); |
| 84 | + assertEquals(1, myResponse.list.size()); |
| 85 | + assertEquals("impl", myResponse.list.get(0).getType()); |
| 86 | + assertNull(myResponse.list.get(0).getMissingInJson()); |
| 87 | + } |
89 | 88 | }
|
0 commit comments