ArgMatchersScope

Scope for registering argument matchers.

Functions

Link copied to clipboard
inline fun <T> ArgMatchersScope.and(first: T, second: T, vararg moreMatchers: T): T

Matches argument that satisfies all the matchers (first, second and all from moreMatchers). It must not receive literals. Only matchers allowed!

Link copied to clipboard
inline fun <T> ArgMatchersScope.any(): T

Matches any argument.

Link copied to clipboard

Matches any sequence of varargs.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun <T> ArgMatchersScope.capture(container: Capture<T>, matcher: T = any()): T

Matches an argument with matcher and captures matching arguments into capture. Arguments are captured only if all other matchers match.

inline fun <T> ArgMatchersScope.capture(list: MutableList<T>, matcher: T = any()): T

Matches an argument with matcher and captures matching arguments into list. Arguments are captured only if all other matchers match.

Link copied to clipboard
inline fun <T> ArgMatchersScope.contentDeepEq(array: Array<T>): Array<T>

Matches an array that is equal to array with contentDeepEquals.

Link copied to clipboard
inline fun <T> ArgMatchersScope.eq(value: T): T

Matches an argument that is equal to value. It can be replaced with value literal.

Link copied to clipboard
inline fun <T> ArgMatchersScope.eqRef(value: T): T

Matches an argument whose reference is equal to value's reference.

Link copied to clipboard
inline fun <T : Comparable<T>> ArgMatchersScope.gt(value: T): T

Matches argument that is greater than value.

Link copied to clipboard
inline fun <T : Comparable<T>> ArgMatchersScope.gte(value: T): T

Matches an argument that is greater than or equal to value.

Link copied to clipboard
inline fun <T> ArgMatchersScope.isIn(vararg values: T): T
inline fun <T> ArgMatchersScope.isIn(values: Iterable<T>): T

Matches argument that is present in values.

Link copied to clipboard
inline fun <T> ArgMatchersScope.isNotIn(vararg values: T): T
inline fun <T> ArgMatchersScope.isNotIn(values: Iterable<T>): T

Matches argument that is not present in values.

Link copied to clipboard
inline fun <T : Comparable<T>> ArgMatchersScope.lt(value: T): T

Matches argument that is less than value.

Link copied to clipboard
inline fun <T : Comparable<T>> ArgMatchersScope.lte(value: T): T

Matches an argument that is less than or equal to value.

Link copied to clipboard
abstract fun <T> matches(argType: KClass<*>, matcher: ArgMatcher<T>): T

Registers matcher with given argType.

Link copied to clipboard

Registers matcher with T::class as argument type.

Link copied to clipboard
inline fun <T> ArgMatchersScope.matching(noinline toString: () -> String = { "matching(...)" }, noinline predicate: (T) -> Boolean): T

Matches an argument according to the predicate. Registered matcher Any.toString calls toString.

Link copied to clipboard
inline fun <T> ArgMatchersScope.matchingBy(function: (T) -> Boolean): T

Matches an argument by calling given function. Also, it returns function name on Any.toString.

Link copied to clipboard
inline fun <T> ArgMatchersScope.neq(value: T): T

Matches an argument that is not equal to value.

Link copied to clipboard
inline fun <T> ArgMatchersScope.neqRef(value: T): T

Matches an argument whose reference is not equal to value's reference.

Link copied to clipboard
inline fun <T> ArgMatchersScope.not(matcher: T): T

Matches argument that does not satisfy matcher. It must not receive literals. Only matchers allowed!

Link copied to clipboard
inline fun <T : Any> ArgMatchersScope.notNull(matcher: T = any()): T?

Matches an argument that is not null and matches matcher.

Link copied to clipboard
inline fun <T> ArgMatchersScope.ofType(): T

Matches an argument that is an instance of type T.

Link copied to clipboard
inline fun <T> ArgMatchersScope.onArg(matcher: T = any(), noinline block: (T) -> Unit): T

Short for capture with Capture.callback.

Link copied to clipboard
inline fun <T> ArgMatchersScope.or(first: T, second: T, vararg moreMatchers: T): T

Matches argument that satisfies any matcher (first, second or any from moreMatchers). It must not receive literals. Only matchers allowed!

Link copied to clipboard
inline fun <T> ArgMatchersScope.varargsAll(noinline predicate: (T) -> Boolean): Array<T>

Matches a sequence of varargs with all elements satisfying the given predicate.

Link copied to clipboard
inline fun <T> ArgMatchersScope.varargsAny(noinline predicate: (T) -> Boolean): Array<T>

Matches a sequence of varargs with any element satisfying the given predicate.

Link copied to clipboard
inline fun ArgMatchersScope.varargsBooleanAll(noinline predicate: (Boolean) -> Boolean): BooleanArray
Link copied to clipboard
inline fun ArgMatchersScope.varargsBooleanAny(noinline predicate: (Boolean) -> Boolean): BooleanArray
Link copied to clipboard
inline fun ArgMatchersScope.varargsByteAll(noinline predicate: (Byte) -> Boolean): ByteArray

varargsAll variant for ByteArray.

Link copied to clipboard
inline fun ArgMatchersScope.varargsByteAny(noinline predicate: (Byte) -> Boolean): ByteArray

varargsAny variant for ByteArray.

Link copied to clipboard
inline fun ArgMatchersScope.varargsCharAll(noinline predicate: (Short) -> Boolean): CharArray

varargsAll variant for CharArray.

Link copied to clipboard
inline fun ArgMatchersScope.varargsCharAny(noinline predicate: (Short) -> Boolean): CharArray

varargsAny variant for CharArray.

Link copied to clipboard
inline fun ArgMatchersScope.varargsDoubleAll(noinline predicate: (Double) -> Boolean): DoubleArray

varargsAll variant for DoubleArray.

Link copied to clipboard
inline fun ArgMatchersScope.varargsDoubleAny(noinline predicate: (Double) -> Boolean): DoubleArray

varargsAny variant for DoubleArray.

Link copied to clipboard
inline fun ArgMatchersScope.varargsFloatAll(noinline predicate: (Float) -> Boolean): FloatArray

varargsAll variant for FloatArray.

Link copied to clipboard
inline fun ArgMatchersScope.varargsFloatAny(noinline predicate: (Float) -> Boolean): FloatArray

varargsAny variant for FloatArray.

Link copied to clipboard
inline fun ArgMatchersScope.varargsIntAll(noinline predicate: (Int) -> Boolean): IntArray

varargsAll variant for IntArray.

Link copied to clipboard
inline fun ArgMatchersScope.varargsIntAny(noinline predicate: (Int) -> Boolean): IntArray

varargsAny variant for IntArray.

Link copied to clipboard
inline fun ArgMatchersScope.varargsLongAll(noinline predicate: (Long) -> Boolean): LongArray

varargsAll variant for LongArray.

Link copied to clipboard
inline fun ArgMatchersScope.varargsLongAny(noinline predicate: (Long) -> Boolean): LongArray

varargsAny variant for LongArray.

Link copied to clipboard
inline fun ArgMatchersScope.varargsShortAll(noinline predicate: (Short) -> Boolean): ShortArray

varargsAll variant for ShortArray.

Link copied to clipboard
inline fun ArgMatchersScope.varargsShortAny(noinline predicate: (Short) -> Boolean): ShortArray

varargsAny variant for ShortArray.

Link copied to clipboard
inline fun ArgMatchersScope.varargsUByteAll(noinline predicate: (UByte) -> Boolean): UByteArray

varargsAll variant for UByteArray.

Link copied to clipboard
inline fun ArgMatchersScope.varargsUByteAny(noinline predicate: (UByte) -> Boolean): UByteArray

varargsAny variant for UByteArray.

Link copied to clipboard
inline fun ArgMatchersScope.varargsUIntAll(noinline predicate: (UInt) -> Boolean): IntArray

varargsAll variant for UIntArray.

Link copied to clipboard
inline fun ArgMatchersScope.varargsUIntAny(noinline predicate: (UInt) -> Boolean): IntArray

varargsAny variant for UIntArray.

Link copied to clipboard
inline fun ArgMatchersScope.varargsULongAll(noinline predicate: (ULong) -> Boolean): ULongArray

varargsAll variant for ULongArray.

Link copied to clipboard
inline fun ArgMatchersScope.varargsULongAny(noinline predicate: (ULong) -> Boolean): ULongArray

varargsAny variant for ULongArray.

Link copied to clipboard
inline fun ArgMatchersScope.varargsUShortAll(noinline predicate: (UShort) -> Boolean): UShortArray

varargsAll variant for UShortArray.

Link copied to clipboard
inline fun ArgMatchersScope.varargsUShortAny(noinline predicate: (UShort) -> Boolean): UShortArray

varargsAny variant for UShortArray.