Skip to content

Commit 966dd97

Browse files
committed
Add unit test for #656
1 parent 5b9f87c commit 966dd97

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

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

+17
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@ public static class GoodSub2 extends GoodItem {
9797

9898
}
9999

100+
// for [databind#656]
101+
@JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include= JsonTypeInfo.As.WRAPPER_OBJECT, defaultImpl=ImplFor656.class)
102+
static abstract class BaseFor656 { }
103+
104+
static class ImplFor656 extends BaseFor656 {
105+
public int a;
106+
}
107+
100108
/*
101109
/**********************************************************
102110
/* Unit tests, deserialization
@@ -177,6 +185,15 @@ public void testInvalidTypeId511() throws Exception {
177185
assertNotNull(badResult);
178186
}
179187

188+
// [Databind#656]
189+
public void testDefaultImplWithObjectWrapper() throws Exception
190+
{
191+
BaseFor656 value = MAPPER.readValue(aposToQuotes("{'foobar':{'a':3}}"), BaseFor656.class);
192+
assertNotNull(value);
193+
assertEquals(ImplFor656.class, value.getClass());
194+
assertEquals(3, ((ImplFor656) value).a);
195+
}
196+
180197
/*
181198
/**********************************************************
182199
/* Unit tests, serialization

0 commit comments

Comments
 (0)