Update URLNormalizationUnitTest.java (baeldung-articles BAEL-6777) (#15779)

This commit is contained in:
DiegoMarti2 2024-01-31 19:08:00 +02:00 committed by GitHub
parent 4bde015e08
commit 9c8cbf668c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 3 deletions

View File

@ -22,7 +22,7 @@ public class URLNormalizationUnitTest {
String normalizedUri = originalUrl.split("\\?")[0];
assertEquals(expectedNormalizedUrl, normalizedUri);
} else {
throw new IllegalArgumentException("Invalid URL: " + originalUrl);
fail(originalUrl);
}
}
@ -35,7 +35,7 @@ public class URLNormalizationUnitTest {
}
@Test
public void givenOriginalUrl_whenUsingRegularExpression_thenNormalizedUrl() throws URISyntaxException, UnsupportedEncodingException {
public void givenOriginalUrl_whenUsingRegularExpression_thenNormalizedUrl() {
String regex = "^(https?://[^/]+/[^?#]+)";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(originalUrl);
@ -44,7 +44,7 @@ public class URLNormalizationUnitTest {
String normalizedUrl = matcher.group(1);
assertEquals(expectedNormalizedUrl, normalizedUrl);
} else {
throw new IllegalArgumentException("Invalid URL: " + originalUrl);
fail(originalUrl);
}
}
}