@@ -318,7 +318,7 @@ void primaryConstructorBindingErrorWithNestedBeanList() {
318
318
}
319
319
320
320
@ Test
321
- void primaryConstructorWithMapArgument () throws Exception {
321
+ void primaryConstructorWithItemMapArgument () throws Exception {
322
322
323
323
Object result = bind (
324
324
"{\" map\" :{\" item1\" :{\" name\" :\" Jason\" ,\" age\" :\" 21\" },\" item2\" :{\" name\" :\" James\" ,\" age\" :\" 22\" }}}" ,
@@ -336,6 +336,25 @@ void primaryConstructorWithMapArgument() throws Exception {
336
336
assertThat (item2 .getAge ()).isEqualTo (22 );
337
337
}
338
338
339
+ @ Test // gh-554
340
+ void primaryConstructorWithRawMapArgument () throws Exception {
341
+
342
+ Object result = bind (
343
+ "{\" map\" :{\" item1\" :{\" name\" :\" Jason\" ,\" age\" :\" 21\" },\" item2\" :{\" name\" :\" James\" ,\" age\" :\" 22\" }}}" ,
344
+ ResolvableType .forClass (PrimaryConstructorRawMapBean .class ));
345
+
346
+ assertThat (result ).isNotNull ().isInstanceOf (PrimaryConstructorRawMapBean .class );
347
+ Map <String , ?> map = ((PrimaryConstructorRawMapBean ) result ).getMap ();
348
+
349
+ Map <String , Object > item1 = (Map <String , Object >) map .get ("item1" );
350
+ assertThat (item1 ).containsEntry ("name" , "Jason" );
351
+ assertThat (item1 ).containsEntry ("age" , "21" );
352
+
353
+ Map <String , Object > item2 = (Map <String , Object >) map .get ("item2" );
354
+ assertThat (item2 ).containsEntry ("name" , "James" );
355
+ assertThat (item2 ).containsEntry ("age" , "22" );
356
+ }
357
+
339
358
@ Test // gh-447
340
359
@ SuppressWarnings ("unchecked" )
341
360
void primaryConstructorWithGenericObject () throws Exception {
@@ -476,6 +495,20 @@ public Map<String, Item> getMap() {
476
495
}
477
496
478
497
498
+ static class PrimaryConstructorRawMapBean {
499
+
500
+ private final Map <String , ?> map ;
501
+
502
+ public PrimaryConstructorRawMapBean (Map <String , ?> map ) {
503
+ this .map = map ;
504
+ }
505
+
506
+ public Map <String , ?> getMap () {
507
+ return this .map ;
508
+ }
509
+ }
510
+
511
+
479
512
@ SuppressWarnings ("OptionalUsedAsFieldOrParameterType" )
480
513
static class PrimaryConstructorOptionalItemBean {
481
514
0 commit comments