File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
src/test/java/com/fasterxml/jackson/failing Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .failing ;
2
+
3
+ import java .util .List ;
4
+
5
+ import org .junit .jupiter .api .Assertions ;
6
+ import org .junit .jupiter .api .Test ;
7
+
8
+ import com .fasterxml .jackson .annotation .*;
9
+
10
+ import com .fasterxml .jackson .databind .ObjectMapper ;
11
+ import com .fasterxml .jackson .databind .testutil .DatabindTestUtil ;
12
+
13
+ public class ObjectIdSubTypes4607Test extends DatabindTestUtil
14
+ {
15
+ @ JsonIdentityInfo (generator = ObjectIdGenerators .StringIdGenerator .class )
16
+ @ JsonTypeInfo (use = JsonTypeInfo .Id .NAME )
17
+ @ JsonSubTypes ({
18
+ @ JsonSubTypes .Type (value = EnumTypeDefinition .class , name = "enum" ),
19
+ @ JsonSubTypes .Type (value = NumberTypeDefinition .class , name = "number" )
20
+ })
21
+ interface TypeDefinition {
22
+ }
23
+
24
+ static class EnumTypeDefinition implements TypeDefinition {
25
+ public List <String > values ;
26
+ }
27
+
28
+ static class NumberTypeDefinition implements TypeDefinition {
29
+ }
30
+
31
+ @ Test
32
+ public void shouldHandleTypeDefinitionJson () throws Exception {
33
+ final ObjectMapper mapper = newJsonMapper ();
34
+ TypeDefinition model = mapper .readValue ("{ \" @type\" : \" number\" }" , TypeDefinition .class );
35
+ Assertions .assertInstanceOf (NumberTypeDefinition .class , model );
36
+ }
37
+ }
38
+
You can’t perform that action at this time.
0 commit comments