Skip to content

Commit 2520c29

Browse files
committed
...
1 parent d96e2cc commit 2520c29

File tree

2 files changed

+20
-34
lines changed

2 files changed

+20
-34
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.fasterxml.jackson.annotation.JsonTypeInfo;
77

88
import com.fasterxml.jackson.databind.*;
9+
import com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping;
910

1011
public class PolymorphicViaRefTypeTest extends BaseMapTest
1112
{
@@ -28,6 +29,15 @@ static class TypeInfoAtomic {
2829
public AtomicReference<BaseForAtomic> value;
2930
}
3031

32+
static class AtomicStringWrapper {
33+
public AtomicReference<StringWrapper> wrapper;
34+
35+
protected AtomicStringWrapper() { }
36+
public AtomicStringWrapper(String str) {
37+
wrapper = new AtomicReference<StringWrapper>(new StringWrapper(str));
38+
}
39+
}
40+
3141
/*
3242
/**********************************************************************
3343
/* Test methods
@@ -44,4 +54,14 @@ public void testPolymorphicAtomicRefProperty() throws Exception
4454
TypeInfoAtomic result = MAPPER.readValue(json, TypeInfoAtomic.class);
4555
assertNotNull(result);
4656
}
57+
58+
public void testAtomicRefViaDefaultTyping() throws Exception
59+
{
60+
ObjectMapper mapper = new ObjectMapper();
61+
mapper.enableDefaultTyping(DefaultTyping.NON_FINAL);
62+
AtomicStringWrapper data = new AtomicStringWrapper("foo");
63+
String json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(data);
64+
AtomicStringWrapper result = mapper.readValue(json, AtomicStringWrapper.class);
65+
assertNotNull(result);
66+
}
4767
}

src/test/java/com/fasterxml/jackson/failing/PolymorphicViaRefTypeTest.java

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)