|
8 | 8 | import com.fasterxml.jackson.databind.BaseMapTest;
|
9 | 9 | import com.fasterxml.jackson.databind.ObjectMapper;
|
10 | 10 |
|
11 |
| -// Tests for [JACKSON-453] |
| 11 | +// Tests for External type id, one that exists at same level as typed Object, |
| 12 | +// that is, property is not within typed object but a member of its parent. |
12 | 13 | public class TestExternalId extends BaseMapTest
|
13 | 14 | {
|
14 | 15 | static class ExternalBean
|
@@ -280,6 +281,13 @@ public void testSimpleDeserialization() throws Exception
|
280 | 281 | assertNotNull(result.bean);
|
281 | 282 | ValueBean vb = (ValueBean) result.bean;
|
282 | 283 | assertEquals(11, vb.value);
|
| 284 | + |
| 285 | + // let's also test with order switched: |
| 286 | + result = mapper.readValue("{\"extType\":\"vbean\", \"bean\":{\"value\":13}}", ExternalBean.class); |
| 287 | + assertNotNull(result); |
| 288 | + assertNotNull(result.bean); |
| 289 | + vb = (ValueBean) result.bean; |
| 290 | + assertEquals(13, vb.value); |
283 | 291 | }
|
284 | 292 |
|
285 | 293 | // Test for verifying that it's ok to have multiple (say, 3)
|
@@ -320,6 +328,11 @@ public void testImproperExternalIdDeserialization() throws Exception
|
320 | 328 | FunkyExternalBean.class);
|
321 | 329 | assertNotNull(result);
|
322 | 330 | assertEquals(3, result.i);
|
| 331 | + |
| 332 | + result = MAPPER.readValue("{\"i\":4,\"extType\":\"funk\"}", |
| 333 | + FunkyExternalBean.class); |
| 334 | + assertNotNull(result); |
| 335 | + assertEquals(4, result.i); |
323 | 336 | }
|
324 | 337 |
|
325 | 338 | public void testIssue798() throws Exception
|
|
0 commit comments