Polishing contribution

Closes gh-34783
This commit is contained in:
rstoyanchev
2025-04-23 10:53:51 +01:00
parent 124582d910
commit 858c2bd270
2 changed files with 8 additions and 12 deletions

View File

@@ -629,18 +629,15 @@ class UriComponentsBuilderTests {
assertThat(uri.toString()).isEqualTo("ws://example.org:7777/path?q=1#foo");
}
@ParameterizedTest
@ParameterizedTest // gh-34783
@EnumSource
void parseBuildAndExpandHierarchicalWithDuplicateQueryKeys(ParserType parserType) {
UriComponents result = UriComponentsBuilder.fromUriString("/?{pk1}={pv1}&{pk2}={pv2}", parserType)
void parseBuildAndExpandQueryParamWithSameName(ParserType parserType) {
UriComponents result = UriComponentsBuilder
.fromUriString("/?{pk1}={pv1}&{pk2}={pv2}", parserType)
.buildAndExpand("k1", "v1", "k1", "v2");
assertThat(result.getQuery()).isEqualTo("k1=v1&k1=v2");
assertThat(result.getQueryParams().get("k1")).containsExactly("v1", "v2");
UriComponents result2 = UriComponentsBuilder.fromUriString("/?{pk1}={pv1}&{pk2}={pv2}", parserType)
.buildAndExpand(Map.of("pk1", "k1", "pv1", "v1", "pk2", "k1", "pv2", "v2"));
assertThat(result2.getQuery()).isEqualTo("k1=v1&k1=v2");
assertThat(result.getQueryParams().get("k1")).containsExactly("v1", "v2");
assertThat(result.getQuery()).isEqualTo("k1=v1&k1=v2");
assertThat(result.getQueryParams()).containsExactly(Map.entry("k1", List.of("v1", "v2")));
}
@ParameterizedTest