#1165 - Fix for potential NullPointerException in UriTemplate.

UriTemplate.with(TemplateVariable) now properly forwards the UriBuilderFactory from the current instance.
This commit is contained in:
Oliver Drotbohm
2020-01-14 13:59:44 +01:00
parent 60cf2a828e
commit ad3e35bdf1
2 changed files with 17 additions and 4 deletions

View File

@@ -291,6 +291,15 @@ class UriTemplateUnitTest {
}
}
@Test // #1165
void expandsTemplateWithAddedVariable() {
UriTemplate template = UriTemplate.of("/foo") //
.with(new TemplateVariable("bar", VariableType.REQUEST_PARAM));
assertThat(template.expand("value").toString()).isEqualTo("/foo?bar=value");
}
private static void assertVariables(UriTemplate template, TemplateVariable... variables) {
assertVariables(template, Arrays.asList(variables));
}