7
7
import java .util .Map ;
8
8
9
9
import org .junit .Before ;
10
+ import org .junit .Ignore ;
10
11
import org .junit .Test ;
11
12
import org .springframework .core .convert .converter .Converter ;
12
13
import org .springframework .core .convert .support .ConversionServiceFactory ;
@@ -62,6 +63,28 @@ public void listElement() throws Exception {
62
63
}
63
64
64
65
@ Test
66
+ public void listElementAutogrowObject () throws Exception {
67
+ request .setRequestURI ("/nested/listElement" );
68
+ request .addParameter ("nested.list[0].foo" , "Nested" );
69
+ adapter .handle (request , response , controller );
70
+ }
71
+
72
+ @ Test
73
+ public void listOfListsElement () throws Exception {
74
+ request .setRequestURI ("/nested/listOfLists" );
75
+ request .addParameter ("nested.listOfLists[0][0]" , "Nested" );
76
+ adapter .handle (request , response , controller );
77
+ }
78
+
79
+ @ Test
80
+ public void listOfListsElementAutogrowObject () throws Exception {
81
+ request .setRequestURI ("/nested/listOfLists" );
82
+ request .addParameter ("nested.listOfLists[0][0].foo" , "Nested" );
83
+ adapter .handle (request , response , controller );
84
+ }
85
+
86
+ @ Test
87
+ @ Ignore
65
88
public void map () throws Exception {
66
89
request .setRequestURI ("/nested/map" );
67
90
request .addParameter ("nested.map['apple'].foo" , "bar" );
@@ -90,6 +113,11 @@ public void handlerMap(JavaBean bean) {
90
113
public void handlerListElement (JavaBean bean ) {
91
114
assertEquals ("Nested" , bean .nested .list .get (0 ).foo );
92
115
}
116
+
117
+ @ RequestMapping ("/nested/listOfLists" )
118
+ public void handlerListOfLists (JavaBean bean ) {
119
+ assertEquals ("Nested" , bean .nested .listOfLists .get (0 ).get (0 ).foo );
120
+ }
93
121
94
122
}
95
123
@@ -113,7 +141,9 @@ public static class NestedBean {
113
141
private String foo ;
114
142
115
143
private List <NestedBean > list ;
116
-
144
+
145
+ private List <List <NestedBean >> listOfLists ;
146
+
117
147
private Map <String , NestedBean > map = new HashMap <String , NestedBean >();
118
148
119
149
public NestedBean () {
@@ -148,7 +178,13 @@ public void setMap(Map<String, NestedBean> map) {
148
178
this .map = map ;
149
179
}
150
180
151
-
181
+ public List <List <NestedBean >> getListOfLists () {
182
+ return listOfLists ;
183
+ }
184
+
185
+ public void setListOfLists (List <List <NestedBean >> listOfLists ) {
186
+ this .listOfLists = listOfLists ;
187
+ }
152
188
153
189
}
154
190
0 commit comments