Skip to content

Commit b9df8c9

Browse files
committed
Add bit more variation on tests of External type id
1 parent 32a52b2 commit b9df8c9

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/test/java/com/fasterxml/jackson/databind/jsontype/TestExternalId.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
import com.fasterxml.jackson.databind.BaseMapTest;
99
import com.fasterxml.jackson.databind.ObjectMapper;
1010

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.
1213
public class TestExternalId extends BaseMapTest
1314
{
1415
static class ExternalBean
@@ -280,6 +281,13 @@ public void testSimpleDeserialization() throws Exception
280281
assertNotNull(result.bean);
281282
ValueBean vb = (ValueBean) result.bean;
282283
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);
283291
}
284292

285293
// Test for verifying that it's ok to have multiple (say, 3)
@@ -320,6 +328,11 @@ public void testImproperExternalIdDeserialization() throws Exception
320328
FunkyExternalBean.class);
321329
assertNotNull(result);
322330
assertEquals(3, result.i);
331+
332+
result = MAPPER.readValue("{\"i\":4,\"extType\":\"funk\"}",
333+
FunkyExternalBean.class);
334+
assertNotNull(result);
335+
assertEquals(4, result.i);
323336
}
324337

325338
public void testIssue798() throws Exception

0 commit comments

Comments
 (0)