Skip to content

Commit 8c3cb51

Browse files
author
Dave Syer
committed
Add extra test for nested list binding
1 parent 620e98c commit 8c3cb51

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

spring-boot/src/test/java/org/springframework/boot/bind/RelaxedDataBinderTests.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,14 @@ public void testBindNestedReadOnlyListIndexed() throws Exception {
235235
assertEquals("[bar, foo]", target.getNested().toString());
236236
}
237237

238+
@Test
239+
public void testBindDoubleNestedReadOnlyListIndexed() throws Exception {
240+
TargetWithReadOnlyDoubleNestedList target = new TargetWithReadOnlyDoubleNestedList();
241+
this.conversionService = new DefaultConversionService();
242+
bind(target, "bean.nested[0]:bar\nbean.nested[1]:foo");
243+
assertEquals("[bar, foo]", target.getBean().getNested().toString());
244+
}
245+
238246
@Test
239247
public void testBindNestedReadOnlyCollectionIndexed() throws Exception {
240248
TargetWithReadOnlyNestedCollection target = new TargetWithReadOnlyNestedCollection();
@@ -561,6 +569,14 @@ public List<String> getNested() {
561569
}
562570
}
563571

572+
public static class TargetWithReadOnlyDoubleNestedList {
573+
TargetWithReadOnlyNestedList bean = new TargetWithReadOnlyNestedList();
574+
575+
public TargetWithReadOnlyNestedList getBean() {
576+
return this.bean;
577+
}
578+
}
579+
564580
public static class TargetWithReadOnlyNestedCollection {
565581
private final Collection<String> nested = new ArrayList<String>();
566582

0 commit comments

Comments
 (0)