From 46b84bef3829433dda7feb488f0c79875275e3d0 Mon Sep 17 00:00:00 2001 From: Oliver Drotbohm Date: Thu, 28 Oct 2021 20:47:21 +0200 Subject: [PATCH] #1683 - Backport of tests. Backport of the tests introduced with 071256 to make sure the problem doesn't exist in this branch. --- .../springframework/hateoas/UriTemplateUnitTest.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/springframework/hateoas/UriTemplateUnitTest.java b/src/test/java/org/springframework/hateoas/UriTemplateUnitTest.java index 0b60e568..87be72a5 100755 --- a/src/test/java/org/springframework/hateoas/UriTemplateUnitTest.java +++ b/src/test/java/org/springframework/hateoas/UriTemplateUnitTest.java @@ -39,7 +39,7 @@ import org.apache.commons.io.output.ByteArrayOutputStream; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import org.springframework.hateoas.TemplateVariable.*; +import org.springframework.hateoas.TemplateVariable.VariableType; /** * Unit tests for {@link UriTemplate}. @@ -362,6 +362,15 @@ class UriTemplateUnitTest { .isEqualTo(URI.create("http://localhost/foo/bar/value")); } + @Test // #1696 + void adaptsRequestParamVariableToContinuationIfBaseUriContainsParameter() { + + UriTemplate template = UriTemplate.of("/path/{bar}/foo.zip?type=foo") + .with(new TemplateVariable("foobar", VariableType.REQUEST_PARAM)); + + assertThat(template.toString()).isEqualTo("/path/{bar}/foo.zip?type=foo{&foobar}"); + } + private static void assertVariables(UriTemplate template, TemplateVariable... variables) { assertVariables(template, Arrays.asList(variables)); }