mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:30:28 +00:00
Polishing in UriComponentsTests
See gh-37117
This commit is contained in:
@@ -196,16 +196,20 @@ class UriComponentsTests {
|
||||
|
||||
@ParameterizedTest // gh-28521
|
||||
@EnumSource
|
||||
void invalidPort(ParserType parserType) {
|
||||
void invalidPortParsed(ParserType parserType) {
|
||||
assertThatExceptionOfType(InvalidUrlException.class)
|
||||
.isThrownBy(() -> fromUriString("https://example.com:XXX/bar", parserType));
|
||||
assertExceptionsForInvalidPort(fromUriString("https://example.com/bar", parserType).port("XXX").build());
|
||||
}
|
||||
|
||||
private void assertExceptionsForInvalidPort(UriComponents uriComponents) {
|
||||
@ParameterizedTest
|
||||
@EnumSource
|
||||
void invalidPortSet(ParserType parserType) {
|
||||
UriComponents uriComponents = fromUriString("https://example.com/bar", parserType).port("XXX").build();
|
||||
|
||||
assertThatIllegalStateException()
|
||||
.isThrownBy(uriComponents::getPort)
|
||||
.withMessage("The port must be an integer: XXX");
|
||||
|
||||
assertThatIllegalStateException()
|
||||
.isThrownBy(uriComponents::toUri)
|
||||
.withMessage("The port must be an integer: XXX");
|
||||
|
||||
Reference in New Issue
Block a user