Add hasText assertion to IpAddressMatcher constructor

Issue gh-15527

(cherry picked from commit 3a29819651)
This commit is contained in:
Steve Riesenberg
2024-11-14 23:12:51 -06:00
parent 554df6fab6
commit ddf4542a9e
2 changed files with 15 additions and 0 deletions

View File

@@ -139,4 +139,18 @@ public class IpAddressMatcherTests {
assertThat(this.v4matcher.matches((String) null)).isFalse();
}
// gh-15527
@Test
public void constructorWhenRequiredAddressIsNullThenThrowsIllegalArgumentException() {
assertThatIllegalArgumentException().isThrownBy(() -> new IpAddressMatcher(null))
.withMessage("ipAddress cannot be empty");
}
// gh-15527
@Test
public void constructorWhenRequiredAddressIsEmptyThenThrowsIllegalArgumentException() {
assertThatIllegalArgumentException().isThrownBy(() -> new IpAddressMatcher(""))
.withMessage("ipAddress cannot be empty");
}
}