Expect
A type representing a value under assertion.
The Expect interface wraps a value and provides a way to expose it for assertion checks. It serves as the foundation for the assertion DSL, allowing for chained assertion calls in a type-safe manner.
Implementations of this functional interface must provide the exposeValue function, which returns the underlying value being asserted on.
Type Parameters
The type of the value being asserted on. This is a covariant type parameter, allowing for flexible subtyping in assertion chains.
Types
Functions
inline fun <Value> Expect<Value>.assert(checker: (Value) -> AssertionScope.Assertion)
Exposes the underlying value being asserted on.
infix fun Expect<Any?>.notToBeTheSameInstanceAs(expected: Any?)
Asserts that the exposed value is not the same instance as the expected value using !== comparison.
infix fun <Element : Comparable<Element>> Expect<Element>.toBeGreaterThan(expected: Element)
Asserts that the exposed value is greater than the expected value.
infix fun <Element : Comparable<Element>> Expect<Element>.toBeGreaterThanOrEqualTo(expected: Element)
Asserts that the exposed value is greater than or equal to the expected value.
infix fun <Element : Comparable<Element>> Expect<Element>.toBeLessThan(expected: Element)
Asserts that the exposed value is less than the expected value.
infix fun <Element : Comparable<Element>> Expect<Element>.toBeLessThanOrEqualTo(expected: Element)
Asserts that the exposed value is less than or equal to the expected value.
Asserts that the exposed value is the same instance as the expected value using === comparison.
Transforms an Expect assertion from one value type to another using a lazily-evaluated provider function.