#160 - Fixed UriTemplate.expand(…) method declaration.
UriTemplate.expand(Map) not takes a Map<String, ? extends Object> to make sure Link.expand(Map) binds to the correct method. Previously it was bound to the method overload taking an Object vararg which caused an invalid expansion.
This commit is contained in:
@@ -179,7 +179,7 @@ public class UriTemplate implements Iterable<TemplateVariable> {
|
||||
* @param parameters must not be {@literal null}.
|
||||
* @return
|
||||
*/
|
||||
public URI expand(Map<String, Object> parameters) {
|
||||
public URI expand(Map<String, ? extends Object> parameters) {
|
||||
|
||||
if (TemplateVariables.NONE.equals(variables)) {
|
||||
return URI.create(baseUri);
|
||||
|
||||
@@ -124,7 +124,7 @@ public class UriTemplateUnitTest {
|
||||
|
||||
UriTemplate template = new UriTemplate("/foo{?bar}");
|
||||
|
||||
URI uri = template.expand(Collections.<String, Object> singletonMap("bar", "myBar"));
|
||||
URI uri = template.expand(Collections.singletonMap("bar", "myBar"));
|
||||
assertThat(uri.toString(), is("/foo?bar=myBar"));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user