#271 - UriTemplate now correctly expands non-optional path segments.

This commit is contained in:
Oliver Gierke
2015-02-10 14:16:10 +01:00
parent 313afe1cc7
commit c41b28e00d
2 changed files with 19 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -232,6 +232,16 @@ public class UriTemplateUnitTest {
assertThat(result.getVariableNames(), is(empty()));
}
/**
* @see #271
*/
@Test
public void expandASimplePathVariable() {
UriTemplate template = new UriTemplate("/foo/{id}");
assertThat(template.expand(2).toString(), is("/foo/2"));
}
private static void assertVariables(UriTemplate template, TemplateVariable... variables) {
assertVariables(template, Arrays.asList(variables));
}