8
8
import com .fasterxml .jackson .databind .*;
9
9
10
10
@ SuppressWarnings ("serial" )
11
- public class MapFormat476Test extends BaseMapTest
11
+ public class MapFormatShapeTest extends BaseMapTest
12
12
{
13
13
@ JsonPropertyOrder ({ "extra" })
14
14
static class Map476Base extends LinkedHashMap <String ,Integer > {
@@ -56,14 +56,14 @@ public Bean476Override(int value) {
56
56
57
57
/*
58
58
/**********************************************************
59
- /* Test methods
59
+ /* Test methods, serialization
60
60
/**********************************************************
61
61
*/
62
62
63
63
final private ObjectMapper MAPPER = objectMapper ();
64
64
// for [databind#476]: Maps as POJOs
65
65
66
- public void testAsPOJOViaClass () throws Exception
66
+ public void testSerializeAsPOJOViaClass () throws Exception
67
67
{
68
68
String result = MAPPER .writeValueAsString (new Bean476Container (1 ,2 ,0 ));
69
69
assertEquals (aposToQuotes ("{'a':{'extra':13,'empty':false},'b':{'value':2}}" ),
@@ -73,19 +73,33 @@ public void testAsPOJOViaClass() throws Exception
73
73
// Can't yet use per-property overrides at all, see [databind#1419]
74
74
75
75
/*
76
- public void testAsPOJOViaProperty () throws Exception
76
+ public void testSerializeAsPOJOViaProperty () throws Exception
77
77
{
78
78
String result = MAPPER.writeValueAsString(new Bean476Container(1,0,3));
79
79
assertEquals(aposToQuotes("{'a':{'extra':13,'empty':false},'c':{'empty':false,'value':3}}"),
80
80
result);
81
81
}
82
82
83
- public void testNaturalViaOverride () throws Exception
83
+ public void testSerializeNaturalViaOverride () throws Exception
84
84
{
85
85
String result = MAPPER.writeValueAsString(new Bean476Override(123));
86
86
assertEquals(aposToQuotes("{'stuff':{'value':123}}"),
87
87
result);
88
88
}
89
89
*/
90
90
91
+ /*
92
+ /**********************************************************
93
+ /* Test methods, deserialization/roundtrip
94
+ /**********************************************************
95
+ */
96
+
97
+ // [databind#1554]
98
+ public void testDeserializeAsPOJOViaClass () throws Exception
99
+ {
100
+ Map476AsPOJO result = MAPPER .readValue (aposToQuotes ("{'extra':42}" ),
101
+ Map476AsPOJO .class );
102
+ assertEquals (0 , result .size ());
103
+ assertEquals (42 , result .extra );
104
+ }
91
105
}
0 commit comments