doc / ch.tutteli.atrium.api.infix.en_GB / containsRegex

containsRegex

infix fun <T : CharSequence> Expect<T>.containsRegex(pattern: String): Expect<T> (source)

Expects that the subject of this expectation (a CharSequence) contains a sequence which matches the given regular expression pattern.

It is a shortcut for contains o atLeast 1 regex pattern.

expect("ABC") containsRegex "A(B)?"

fails {
    expect("ABC") containsRegex "X"
}

Parameters

pattern - The pattern which is expected to have a match against the input of the search.

Return
This assertion container to support a fluent API.