kotest-assertions / io.kotest.matchers / MatcherResult

MatcherResult

interface MatcherResult

An instance of MatcherResult contains the result of an evaluation of a Matcher.

Functions

failureMessage

Returns a message indicating why the evaluation failed for when this matcher is used in the positive sense. For example, if a size matcher was used like mylist should haveSize(5) then an appropriate error message would be "list should be size 5".

abstract fun failureMessage(): String

negatedFailureMessage

Returns a message indicating why the evaluation failed for when this matcher is used in the negative sense. For example, if a size matcher was used like mylist shouldNot haveSize(5) then an appropriate negated failure would be "List should not have size 5".

abstract fun negatedFailureMessage(): String

passed

Returns true if the matcher indicated this was a valid value and false if the matcher indicated an invalid value.

abstract fun passed(): Boolean

Companion Object Functions

invoke

operator fun invoke(passed: Boolean, failureMessage: String, negatedFailureMessage: String): MatcherResult
operator fun invoke(passed: Boolean, failureMessageFn: () -> String, negatedFailureMessageFn: () -> String): MatcherResult