From 966dd97fa4d4cef3a10b4b37f6fdf9ebb2a0f6a4 Mon Sep 17 00:00:00 2001 From: Cowtowncoder Date: Wed, 17 Dec 2014 11:07:24 -0800 Subject: [PATCH] Add unit test for #656 --- .../TestPolymorphicWithDefaultImpl.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestPolymorphicWithDefaultImpl.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestPolymorphicWithDefaultImpl.java index bf2d3d86d0..2c5dc64a86 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestPolymorphicWithDefaultImpl.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestPolymorphicWithDefaultImpl.java @@ -97,6 +97,14 @@ public static class GoodSub2 extends GoodItem { } + // for [databind#656] + @JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include= JsonTypeInfo.As.WRAPPER_OBJECT, defaultImpl=ImplFor656.class) + static abstract class BaseFor656 { } + + static class ImplFor656 extends BaseFor656 { + public int a; + } + /* /********************************************************** /* Unit tests, deserialization @@ -177,6 +185,15 @@ public void testInvalidTypeId511() throws Exception { assertNotNull(badResult); } + // [Databind#656] + public void testDefaultImplWithObjectWrapper() throws Exception + { + BaseFor656 value = MAPPER.readValue(aposToQuotes("{'foobar':{'a':3}}"), BaseFor656.class); + assertNotNull(value); + assertEquals(ImplFor656.class, value.getClass()); + assertEquals(3, ((ImplFor656) value).a); + } + /* /********************************************************** /* Unit tests, serialization