2
2
3
3
import java .util .List ;
4
4
5
- import com .fasterxml .jackson .annotation .JsonIdentityInfo ;
6
- import com .fasterxml .jackson .annotation .JsonSubTypes ;
7
- import com .fasterxml .jackson .annotation .JsonTypeInfo ;
8
- import com .fasterxml .jackson .annotation .ObjectIdGenerators ;
9
- import com .fasterxml .jackson .databind .ObjectMapper ;
10
-
11
5
import org .junit .jupiter .api .Assertions ;
12
6
import org .junit .jupiter .api .Test ;
13
7
14
- import static com .fasterxml .jackson .databind . BaseMapTest . newJsonMapper ;
8
+ import com .fasterxml .jackson .annotation .* ;
15
9
16
- public class TypeId4607Test {
10
+ import com .fasterxml .jackson .databind .ObjectMapper ;
11
+ import com .fasterxml .jackson .databind .testutil .DatabindTestUtil ;
17
12
13
+ public class ObjectIdSubTypes4607Test extends DatabindTestUtil
14
+ {
18
15
@ JsonIdentityInfo (generator = ObjectIdGenerators .StringIdGenerator .class )
19
16
@ JsonTypeInfo (use = JsonTypeInfo .Id .NAME )
20
17
@ JsonSubTypes ({
@@ -31,16 +28,13 @@ static class EnumTypeDefinition implements TypeDefinition {
31
28
static class NumberTypeDefinition implements TypeDefinition {
32
29
}
33
30
34
- private static final ObjectMapper mapper = newJsonMapper ();
35
-
36
31
@ Test
37
32
public void shouldHandleTypeDefinitionJson () throws Exception {
33
+ final ObjectMapper mapper = newJsonMapper ();
38
34
String input = "{" +
39
35
" \" @type\" : \" number\" " +
40
36
" }" ;
41
-
42
37
TypeDefinition model = mapper .readValue (input , TypeDefinition .class );
43
-
44
38
Assertions .assertInstanceOf (NumberTypeDefinition .class , model );
45
39
}
46
40
}
0 commit comments