fun <T : CharSequence> CharSequenceContainsCheckerBuilder<T, CharSequenceContainsNoOpSearchBehaviour>.regex(pattern: Any, vararg otherPatterns: Any): IAssertionPlant<T>
Finishes the specification of the sophisticated contains
assertion where the given pattern as well as
the otherPatterns are expected to have a match, using a non disjoint search.
By non disjoint is meant that 'aa'
in 'aaaa'
is found three times and not only two times.
Also notice, that it does not search for unique matches. Meaning, if the input of the search is 'ab'
and pattern
is defined as 'a(b)?'
and one of the otherPatterns is defined as 'a(b)?'
as well, then both match, even though
they match the same sequence in the input of the search. Use an option such as zumindest, hoechstens and genau
to control the number of occurrences you expect.
Meaning you might want to use:
enthaelt.genau(2).regex('a(b)?')
instead of:
enthaelt.zumindest(1).regex('a(b)?', 'a(b)?')
pattern
- The pattern which is expected to have a match against the input of the search.
otherPatterns
- Additional patterns which are expected to have a match against the input of the search.
AssertionError
- Might throw an AssertionError if the assertion made is not correct.
Return
The IAssertionPlant for which the assertion was built to support a fluent API.
fun <T : CharSequence> CharSequenceContainsCheckerBuilder<T, CharSequenceContainsIgnoringCaseSearchBehaviour>.regex(pattern: Any, vararg otherPatterns: Any): IAssertionPlant<T>
Finishes the specification of the sophisticated contains
assertion where the given pattern as well as
the otherPatterns are expected to have a match (ignoring case), using a non disjoint search.
By non disjoint is meant that 'aa'
in 'aaaa'
is found three times and not only two times.
Also notice, that it does not search for unique matches. Meaning, if the input of the search is 'ab'
and pattern
is defined as 'a(b)?'
and one of the otherPatterns is defined as 'a(b)?'
as well, then both match, even though
they match the same sequence in the input of the search. Use an option such as zumindest, hoechstens and genau
to control the number of occurrences you expect.
Meaning you might want to use:
enthaelt.genau(2).regex('a(b)?')
instead of:
enthaelt.zumindest(1).regex('a(b)?', 'a(b)?')
pattern
- The pattern which is expected to have a match against the input of the search.
otherPatterns
- Additional patterns which are expected to have a match against the input of the search.
AssertionError
- Might throw an AssertionError if the assertion made is not correct.
Return
The IAssertionPlant for which the assertion was built to support a fluent API.