File tree 2 files changed +54
-1
lines changed
src/test/java/com/fasterxml/jackson
2 files changed +54
-1
lines changed Original file line number Diff line number Diff line change 9
9
import com .fasterxml .jackson .databind .BaseMapTest ;
10
10
import com .fasterxml .jackson .databind .ObjectMapper ;
11
11
12
- public class TestGenericTypes extends BaseMapTest
12
+ public class GenericTypeSerializationTest extends BaseMapTest
13
13
{
14
14
static class Account {
15
15
private Long id ;
Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .failing ;
2
+
3
+ import java .util .Map ;
4
+
5
+ import com .fasterxml .jackson .core .type .TypeReference ;
6
+
7
+ import com .fasterxml .jackson .databind .*;
8
+
9
+ public class GenericTypeDeserialization2846Test extends BaseMapTest
10
+ {
11
+ @ SuppressWarnings ("rawtypes" )
12
+ static class GenericEntity <T > {
13
+ T field ;
14
+
15
+ Map map ;
16
+
17
+ public void setField (T field ) {
18
+ this .field = field ;
19
+ }
20
+
21
+ public T getField () {
22
+ return field ;
23
+ }
24
+
25
+ public Map getMap () {
26
+ return map ;
27
+ }
28
+
29
+ public void setMap (Map map ) {
30
+ this .map = map ;
31
+ }
32
+ }
33
+
34
+ static class SimpleEntity {
35
+ Integer number ;
36
+
37
+ public void setNumber (Integer number ) {
38
+ this .number = number ;
39
+ }
40
+
41
+ public Integer getNumber () {
42
+ return number ;
43
+ }
44
+ }
45
+
46
+ public void testIssue2821Part2 () throws Exception {
47
+ ObjectMapper m = new ObjectMapper ();
48
+ final String JSON = "{ \" field\" : { \" number\" : 1 }, \" map\" : { \" key\" : \" value\" } }" ;
49
+ GenericEntity <SimpleEntity > genericEntity = m .readValue (JSON ,
50
+ new TypeReference <GenericEntity <SimpleEntity >>() {});
51
+ assertNotNull (genericEntity );
52
+ }
53
+ }
You can’t perform that action at this time.
0 commit comments