Revert "Update MockCookie#parse(String) validation to align with Javadoc"

This reverts commit 8b894933ae due to
code freeze on main.

See gh-37134
This commit is contained in:
Sam Brannen
2026-08-13 17:15:34 +02:00
parent 951c1f306a
commit e78d3df566
3 changed files with 3 additions and 11 deletions
@@ -132,7 +132,7 @@ public class MockCookie extends Cookie {
* @return the created cookie
*/
public static MockCookie parse(String setCookieHeader) {
Assert.hasText(setCookieHeader, "Set-Cookie header must not be null or empty");
Assert.notNull(setCookieHeader, "Set-Cookie header must not be null");
String[] cookieParts = setCookieHeader.split("\\s*=\\s*", 2);
Assert.isTrue(cookieParts.length == 2, () -> "Invalid Set-Cookie header '" + setCookieHeader + "'");
@@ -118,15 +118,7 @@ class MockCookieTests {
void parseNullHeader() {
assertThatIllegalArgumentException()
.isThrownBy(() -> MockCookie.parse(null))
.withMessageContaining("Set-Cookie header must not be null or empty");
}
@ParameterizedTest
@ValueSource(strings = {"", " "})
void parseEmptyHeader(String header) {
assertThatIllegalArgumentException()
.isThrownBy(() -> MockCookie.parse(header))
.withMessageContaining("Set-Cookie header must not be null or empty");
.withMessageContaining("Set-Cookie header must not be null");
}
@Test