@@ -280,6 +280,21 @@ void primaryConstructorBindingErrorWithNestedBeanList() {
280
280
});
281
281
}
282
282
283
+ @ Test // gh-447
284
+ @ SuppressWarnings ("unchecked" )
285
+ void primaryConstructorWithGenericObject () throws Exception {
286
+
287
+ Object result = this .binder .bind (
288
+ environment ("{\" key\" :{\" value\" :[{\" name\" :\" first\" },{\" name\" :\" second\" }]}}" ), "key" ,
289
+ ResolvableType .forClass (ObjectHolder .class ));
290
+
291
+ assertThat (result ).isNotNull ().isInstanceOf (ObjectHolder .class );
292
+ List <Map <Object , Object >> list = (List <Map <Object , Object >>) ((ObjectHolder ) result ).getValue ();
293
+ assertThat (list ).hasSize (2 ).containsExactly (
294
+ Collections .singletonMap ("name" , "first" ),
295
+ Collections .singletonMap ("name" , "second" ));
296
+ }
297
+
283
298
@ Test // gh-410
284
299
@ SuppressWarnings ("unchecked" )
285
300
void coercionWithSingletonList () throws Exception {
@@ -332,6 +347,7 @@ private DataFetchingEnvironment environment(String jsonPayload) throws JsonProce
332
347
}
333
348
334
349
350
+ @ SuppressWarnings ("unused" )
335
351
static class SimpleBean {
336
352
337
353
private String name ;
@@ -434,6 +450,7 @@ public Optional<Item> getItem() {
434
450
}
435
451
436
452
453
+ @ SuppressWarnings ("unused" )
437
454
static class NoPrimaryConstructorBean {
438
455
439
456
NoPrimaryConstructorBean (String name ) {
@@ -444,6 +461,7 @@ static class NoPrimaryConstructorBean {
444
461
}
445
462
446
463
464
+ @ SuppressWarnings ("unused" )
447
465
static class ItemListHolder {
448
466
449
467
private List <Item > items ;
@@ -458,6 +476,40 @@ public void setItems(List<Item> items) {
458
476
}
459
477
460
478
479
+ @ SuppressWarnings ("unused" )
480
+ static class ItemSetHolder {
481
+
482
+ private Set <Item > items ;
483
+
484
+ public ItemSetHolder (Set <Item > items ) {
485
+ this .items = items ;
486
+ }
487
+
488
+ public Set <Item > getItems () {
489
+ return items ;
490
+ }
491
+
492
+ public void setItems (Set <Item > items ) {
493
+ this .items = items ;
494
+ }
495
+ }
496
+
497
+
498
+ static class ObjectHolder {
499
+
500
+ private final Object value ;
501
+
502
+ ObjectHolder (Object value ) {
503
+ this .value = value ;
504
+ }
505
+
506
+ public Object getValue () {
507
+ return value ;
508
+ }
509
+ }
510
+
511
+
512
+ @ SuppressWarnings ("unused" )
461
513
static class Item {
462
514
463
515
private String name ;
@@ -494,21 +546,4 @@ public int hashCode() {
494
546
}
495
547
}
496
548
497
- static class ItemSetHolder {
498
-
499
- private Set <Item > items ;
500
-
501
- public ItemSetHolder (Set <Item > items ) {
502
- this .items = items ;
503
- }
504
-
505
- public Set <Item > getItems () {
506
- return items ;
507
- }
508
-
509
- public void setItems (Set <Item > items ) {
510
- this .items = items ;
511
- }
512
- }
513
-
514
549
}
0 commit comments