MokkeryTemplatingScope

Scope for declaring call templates. It's used with dev.mokkery.every and dev.mokkery.verify. Currently, it's illegal to declare functions that accept this scope.

Example of a call template inside verify:

verify {
mock.call(any())
}

Properties

Link copied to clipboard

Functions

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

Matches argument that satisfies all the matchers (first, second and all from moreMatchers).

Link copied to clipboard

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
fun <T> MokkeryMatcherScope.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.

fun <T> MokkeryMatcherScope.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
fun <T, R : Iterable<T>> MokkeryMatcherScope.containsAll(predicate: (T) -> Boolean): R

Matches an Iterable with all elements matching predicate

Link copied to clipboard

Matches a BooleanArray with all elements matching predicate

Link copied to clipboard

Matches a ByteArray with all elements matching predicate

Link copied to clipboard

Matches a CharArray with all elements matching predicate

Link copied to clipboard

Matches a DoubleArray with all elements matching predicate

Link copied to clipboard

Matches an Array with all elements matching predicate

Link copied to clipboard

Matches a FloatArray with all elements matching predicate

Link copied to clipboard

Matches a IntArray with all elements matching predicate

Link copied to clipboard

Matches a LongArray with all elements matching predicate

Link copied to clipboard

Matches a ShortArray with all elements matching predicate

Link copied to clipboard

Matches a UByteArray with all elements matching predicate

Link copied to clipboard

Matches a UIntArray with all elements matching predicate

Link copied to clipboard

Matches a ULongArray with all elements matching predicate

Link copied to clipboard

Matches a UShortArray with all elements matching predicate

Link copied to clipboard
fun <T, R : Iterable<T>> MokkeryMatcherScope.containsAny(predicate: (T) -> Boolean): R

Matches an Iterable with any element matching predicate

Link copied to clipboard

Matches a BooleanArray with any element matching predicate

Link copied to clipboard

Matches a ByteArray with any element matching predicate

Link copied to clipboard

Matches a CharArray with any element matching predicate

Link copied to clipboard

Matches a DoubleArray with any element matching predicate

Link copied to clipboard

Matches an Array with any element matching predicate

Link copied to clipboard

Matches a FloatArray with any element matching predicate

Link copied to clipboard

Matches an IntArray with any element matching predicate

Link copied to clipboard

Matches a LongArray with any element matching predicate

Link copied to clipboard

Matches a ShortArray with any element matching predicate

Link copied to clipboard

Matches a UByteArray with any element matching predicate

Link copied to clipboard

Matches a UIntArray with any element matching predicate

Link copied to clipboard

Matches a ULongArray with any element matching predicate

Link copied to clipboard

Matches a UShortArray with any element matching predicate

Link copied to clipboard

Matches an Array that is equal to array with contentDeepEquals.

Link copied to clipboard

Matches an Array that has the same content as array.

Matches an BooleanArray that has the same content as array.

Matches an ByteArray that has the same content as array.

Matches an CharArray that has the same content as array.

Matches an DoubleArray that has the same content as array.

Matches an FloatArray that has the same content as array.

Matches an IntArray that has the same content as array.

Matches an LongArray that has the same content as array.

Matches an ShortArray that has the same content as array.

Matches an UByteArray that has the same content as array.

Matches an UIntArray that has the same content as array.

Matches an ULongArray that has the same content as array.

Matches an UShortArray that has the same content as array.

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

DEPRECATED: This API is considered obsolete. Simply omit this matcher.

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

DEPRECATED: Renamed to ref.

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

Matches argument that is greater than value.

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

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

Link copied to clipboard
fun <T> MokkeryMatcherScope.isIn(vararg values: T): T

Matches argument that is present in values.

Link copied to clipboard
fun <T> MokkeryMatcherScope.isNotIn(vararg values: T): T

Matches argument that is not present in values.

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

Matches argument that is less than value.

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

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

Link copied to clipboard

Matches argument that satisfies a matcher. Cannot be used with ArgMatcher.Composite. Use matchesComposite instead.

fun <T> MokkeryMatcherScope.matches(toString: () -> String, predicate: (T) -> Boolean): T

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

Link copied to clipboard
fun <T> MokkeryMatcherScope.matchesBy(function: (T) -> Boolean): T

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

Link copied to clipboard

Matches an argument that satisfies a matcher composed of matchers with builder.

Link copied to clipboard
fun <T> MokkeryMatcherScope.matching(predicate: (T) -> Boolean): T
fun <T> MokkeryMatcherScope.matching(toString: () -> String, predicate: (T) -> Boolean): T

DEPRECATED: This API is considered obsolete. Use matches instead.

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

DEPRECATED: Renamed to matchesBy

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

Matches an argument that is not equal to value.

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

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

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

Matches argument that does not satisfy matcher.

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

Matches an argument that is not null and matches matcher.

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

Matches an argument that is an instance of type T.

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

Short for capture with Capture.callback.

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

Matches argument that satisfies any matcher (first, second or any from moreMatchers).

Link copied to clipboard
fun <T> MokkeryMatcherScope.ref(value: T): T

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

Link copied to clipboard
inline fun <T> MokkeryMatcherScope.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> MokkeryMatcherScope.varargsAny(noinline predicate: (T) -> Boolean): Array<T>

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

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
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