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

@ -29,7 +29,6 @@ import org.springframework.util.Assert;
* Parser for URI's based on RFC 3986 syntax.
*
* @author Rossen Stoyanchev
* @author Yanming Zhou
* @since 6.2
*
* @see <a href="https://www.rfc-editor.org/info/rfc3986">RFC 3986</a>

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