@@ -97,6 +97,20 @@ static class Outer {
97
97
private Inner inner ;
98
98
}
99
99
100
+ // [databind#1493]: case-insensitive handling
101
+ static class Person {
102
+ @ JsonUnwrapped (prefix = "businessAddress." )
103
+ public Address businessAddress ;
104
+ }
105
+
106
+ static class Address {
107
+ public String street ;
108
+ public String addon ;
109
+ public String zip ;
110
+ public String town ;
111
+ public String country ;
112
+ }
113
+
100
114
/*
101
115
/**********************************************************
102
116
/* Tests, serialization
@@ -192,45 +206,13 @@ public void testUnwrappedAsPropertyIndicator() throws Exception
192
206
assertTrue (actual .contains ("Zebra" ));
193
207
assertFalse (actual .contains ("inner" ));
194
208
}
195
-
196
- // 22-Apr-2013, tatu: Commented out as it can't be simply fixed; requires implementing
197
- // deep-update/merge. But leaving here to help with that effort, if/when it proceeds.
198
-
199
- /*
200
- // [databind#211]: Actually just variant of #160
201
-
202
- static class Issue211Bean {
203
- public String test1;
204
-
205
- public String test2;
206
- @JsonUnwrapped
207
- public Issue211Unwrapped unwrapped;
208
- }
209
209
210
- static class Issue211Unwrapped {
211
- public String test3;
212
- public String test4;
213
- }
214
-
215
- public void testIssue211() throws Exception
210
+ // [databind#1493]: case-insensitive handling
211
+ public void testCaseInsensitiveUnwrap () throws Exception
216
212
{
217
- Issue211Bean bean = new Issue211Bean();
218
- bean.test1 = "Field 1";
219
- bean.test2 = "Field 2";
220
- Issue211Unwrapped tJackson2 = new Issue211Unwrapped();
221
- tJackson2.test3 = "Field 3";
222
- tJackson2.test4 = "Field 4";
223
- bean.unwrapped = tJackson2;
224
-
225
- final String JSON = "{\"test1\": \"Field 1 merged\", \"test3\": \"Field 3 merged\"}";
226
- ObjectMapper o = new ObjectMapper();
227
- Issue211Bean result = o.readerForUpdating(bean).withType(Issue211Bean.class).readValue(JSON);
228
- assertSame(bean, result);
229
- assertEquals("Field 1 merged", result.test1);
230
- assertEquals("Field 2", result.test2);
231
- assertNotNull(result.unwrapped);
232
- assertEquals("Field 3 merged", result.unwrapped.test3);
233
- assertEquals("Field 4", result.unwrapped.test4);
234
- }
235
- */
213
+ ObjectMapper mapper = new ObjectMapper ();
214
+ mapper .enable (MapperFeature .ACCEPT_CASE_INSENSITIVE_PROPERTIES );
215
+ Person p = mapper .readValue ("{ }" , Person .class );
216
+ assertNotNull (p );
217
+ }
236
218
}
0 commit comments