File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed
src/test/java/com/fasterxml/jackson Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change 4
4
5
5
import com .fasterxml .jackson .annotation .JsonSubTypes ;
6
6
import com .fasterxml .jackson .annotation .JsonTypeInfo ;
7
+
7
8
import com .fasterxml .jackson .databind .*;
8
9
9
10
public class PolymorphicViaRefTypeTest extends BaseMapTest
@@ -35,7 +36,7 @@ static class TypeInfoAtomic {
35
36
36
37
private final ObjectMapper MAPPER = objectMapper ();
37
38
38
- public void testOptionalWithAtomic () throws Exception
39
+ public void testPolymorphicAtomicRefProperty () throws Exception
39
40
{
40
41
TypeInfoAtomic data = new TypeInfoAtomic ();
41
42
data .value = new AtomicReference <BaseForAtomic >(new ImplForAtomic (42 ));
Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .failing ;
2
+
3
+ import java .util .concurrent .atomic .AtomicReference ;
4
+
5
+ import com .fasterxml .jackson .databind .*;
6
+ import com .fasterxml .jackson .databind .ObjectMapper .DefaultTyping ;
7
+
8
+ public class PolymorphicViaRefTypeTest extends BaseMapTest
9
+ {
10
+ static class AtomicStringWrapper {
11
+ public AtomicReference <StringWrapper > wrapper ;
12
+
13
+ protected AtomicStringWrapper () { }
14
+ public AtomicStringWrapper (String str ) {
15
+ wrapper = new AtomicReference <StringWrapper >(new StringWrapper (str ));
16
+ }
17
+ }
18
+
19
+ /*
20
+ /**********************************************************************
21
+ /* Test methods
22
+ /**********************************************************************
23
+ */
24
+
25
+ public void testAtomicRefViaDefaultTyping () throws Exception
26
+ {
27
+ ObjectMapper mapper = new ObjectMapper ();
28
+ mapper .enableDefaultTyping (DefaultTyping .NON_FINAL );
29
+ AtomicStringWrapper data = new AtomicStringWrapper ("foo" );
30
+ String json = mapper .writerWithDefaultPrettyPrinter ().writeValueAsString (data );
31
+ AtomicStringWrapper result = mapper .readValue (json , AtomicStringWrapper .class );
32
+ assertNotNull (result );
33
+ }
34
+ }
You can’t perform that action at this time.
0 commit comments