spring-framework / org.springframework.util / Assert / doesNotContain

doesNotContain

open static fun doesNotContain(@Nullable textToSearch: String, substring: String, message: String): Unit

Assert that the given text does not contain the given substring.

Assert.doesNotContain(name, "rod", "Name must not contain 'rod'");

Parameters

textToSearch - the text to search

substring - the substring to find within the text

message - the exception message to use if the assertion fails

Exceptions

IllegalArgumentException - if the text contains the substring

open static fun doesNotContain(@Nullable textToSearch: String, substring: String, messageSupplier: Supplier<String>): Unit

Assert that the given text does not contain the given substring.

 Assert.doesNotContain(name, forbidden, () -> "Name must not contain '" + forbidden + "'"); 

Parameters

textToSearch - the text to search

substring - the substring to find within the text

messageSupplier - a supplier for the exception message to use if the assertion fails

Exceptions

IllegalArgumentException - if the text contains the substring

Since
5.0

open static fun doesNotContain(@Nullable textToSearch: String, substring: String): Unit