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

toContainRegex

infix fun <T : CharSequence> Expect<T>.toContainRegex(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 toContain o atLeast 1 regex pattern.

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

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

Parameters

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

Return
an Expect for the subject of this expectation.

Since
0.17.0