File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
org.springframework.web/src
main/java/org/springframework/web/util
test/java/org/springframework/web/util Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ public List<String> getVariableNames() {
96
96
*/
97
97
public URI expand (Map <String , ?> uriVariables ) {
98
98
Assert .notNull (uriVariables , "'uriVariables' must not be null" );
99
- Object [] values = new String [this .variableNames .size ()];
99
+ Object [] values = new Object [this .variableNames .size ()];
100
100
for (int i = 0 ; i < this .variableNames .size (); i ++) {
101
101
String name = this .variableNames .get (i );
102
102
if (!uriVariables .containsKey (name )) {
Original file line number Diff line number Diff line change @@ -70,6 +70,16 @@ public void expandMap() throws Exception {
70
70
assertEquals ("Invalid expanded template" , new URI ("http://example.com/hotels/1/bookings/42" ), result );
71
71
}
72
72
73
+ @ Test
74
+ public void expandMapNonString () throws Exception {
75
+ Map <String , Integer > uriVariables = new HashMap <String , Integer >(2 );
76
+ uriVariables .put ("booking" , 42 );
77
+ uriVariables .put ("hotel" , 1 );
78
+ UriTemplate template = new UriTemplate ("http://example.com/hotels/{hotel}/bookings/{booking}" );
79
+ URI result = template .expand (uriVariables );
80
+ assertEquals ("Invalid expanded template" , new URI ("http://example.com/hotels/1/bookings/42" ), result );
81
+ }
82
+
73
83
@ Test (expected = IllegalArgumentException .class )
74
84
public void expandMapInvalidAmountVariables () throws Exception {
75
85
UriTemplate template = new UriTemplate ("http://example.com/hotels/{hotel}/bookings/{booking}" );
You can’t perform that action at this time.
0 commit comments