Disjunction

class Disjunction<in T>(left: Matcher<T>, right: Matcher<T>) : Matcher<T>

The logican disjunction ("or") of two matchers. Evaluation is short-cut, so that if the left matcher matches, the right matcher is never invoked.

Use the infix or function or anyOf to combine matchers with a Disjunction.

Constructors

Link copied to clipboard
constructor(left: Matcher<T>, right: Matcher<T>)

Properties

Link copied to clipboard
open override val description: String

The description of this criteria.

Link copied to clipboard
open val negatedDescription: String

Describes the negation of this criteria.

Functions

Link copied to clipboard
infix fun <T> Matcher<T>.and(that: Matcher<T>): Matcher<T>
infix fun <T> Matcher<T>.and(that: (T) -> Boolean): Matcher<T>

Syntactic sugar to create a Matcher.Conjunction

Link copied to clipboard
open fun asPredicate(): (T) -> Boolean

Returns this matcher as a predicate, that can be used for testing, finding and filtering collections and kotlin.sequences.Sequences.

Link copied to clipboard
fun <T> Matcher<T>.describedBy(fn: () -> String): Matcher<T>
Link copied to clipboard
open operator override fun invoke(actual: T): MatchResult

Reports whether the actual value meets the criteria and, if not, why it does not match.

Link copied to clipboard
open operator fun not(): Matcher<T>

Returns a matcher that matches the negation of this criteria.

Link copied to clipboard
infix fun <T> Matcher<T>.or(that: Matcher<T>): Matcher<T>
infix fun <T> Matcher<T>.or(that: (T) -> Boolean): Matcher<T>

Syntactic sugar to create a Matcher.Disjunction