doesNotContain static method
Asserts that the given textToSearch
does not contain the given substring
.
Throws an InvalidArgumentException
with the given message
if the substring
is found in textToSearch
.
Example:
Assert.doesNotContain(email, ' ', 'Email cannot contain spaces');
Implementation
static void doesNotContain(String? textToSearch, String substring, String message) {
if (textToSearch != null && textToSearch.contains(substring)) {
throw InvalidArgumentException(message);
}
}