Polishing contribution

Closes gh-33715
This commit is contained in:
rstoyanchev
2024-10-16 13:06:22 +01:00
parent f35ed8d044
commit ca820c914f
2 changed files with 9 additions and 22 deletions

View File

@@ -633,29 +633,17 @@ class UriComponentsBuilderTests {
@ParameterizedTest // gh-33699
@EnumSource(value = ParserType.class)
void schemeVariableMixedCase(ParserType parserType) {
URI uri = UriComponentsBuilder
.fromUriString("{TheScheme}://example.org", parserType)
.buildAndExpand(Map.of("TheScheme", "ws"))
.toUri();
assertThat(uri.toString()).isEqualTo("ws://example.org");
uri = UriComponentsBuilder
.fromUriString("{TheScheme}s://example.org", parserType)
.buildAndExpand(Map.of("TheScheme", "ws"))
.toUri();
assertThat(uri.toString()).isEqualTo("wss://example.org");
BiConsumer<String, String> tester = (scheme, value) -> {
URI uri = UriComponentsBuilder.fromUriString(scheme + "://example.org", parserType)
.buildAndExpand(Map.of("TheScheme", value))
.toUri();
assertThat(uri.toString()).isEqualTo("wss://example.org");
};
uri = UriComponentsBuilder
.fromUriString("s{TheScheme}://example.org", parserType)
.buildAndExpand(Map.of("TheScheme", "ws"))
.toUri();
assertThat(uri.toString()).isEqualTo("sws://example.org");
uri = UriComponentsBuilder
.fromUriString("s{TheScheme}s://example.org", parserType)
.buildAndExpand(Map.of("TheScheme", "ws"))
.toUri();
assertThat(uri.toString()).isEqualTo("swss://example.org");
tester.accept("{TheScheme}", "wss");
tester.accept("{TheScheme}s", "ws");
tester.accept("ws{TheScheme}", "s");
}
@ParameterizedTest