#137 - Fixed variable expansion in UriTemplate.

We now eagerly return from UriTemplate.expand(…) if the template doesn't actually contain any variables.
This commit is contained in:
Oliver Gierke
2014-01-22 14:59:01 +01:00
parent 3c62de720f
commit 64fd8543b6
3 changed files with 21 additions and 5 deletions

View File

@@ -169,6 +169,14 @@ public class UriTemplateUnitTest {
assertThat(new UriTemplate("/foo").expand().toString(), is("/foo"));
}
/**
* @see #137
*/
@Test
public void correctlyExpandsFullUri() {
assertThat(new UriTemplate("http://localhost:8080/foo{?bar}").expand().toString(), is("http://localhost:8080/foo"));
}
private static void assertVariables(UriTemplate template, TemplateVariable... variables) {
assertThat(template.getVariableNames(), hasSize(variables.length));