Package-level declarations

Types

Link copied to clipboard
interface Capture<in T>

Container for captured values. If dev.mokkery.matcher.ArgMatcher implements this interface, Capture.capture is called on full match (all matchers for given call match). Implementing Capture is not recommended. Use CaptureMatcher.

Link copied to clipboard
class CaptureMatcher<T>(capture: Capture<T>, matcher: ArgMatcher<T>? = null) : ArgMatcher.Composite<T>

Matches an argument with matcher and captures arguments into capture.

Link copied to clipboard
interface ContainerCapture<T> : Capture<T>

A capture that is able to store elements.

Link copied to clipboard

Capture that stores only the last value.

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Returns a Capture that stores values in this list.

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
fun <T> SlotCapture<T>.get(): T

Returns unwrapped SlotCapture.value if it is SlotCapture.Value.Present. Otherwise, it fails.

Link copied to clipboard

Returns unwrapped SlotCapture.value if it is SlotCapture.Value.Present. Otherwise, it returns null.

Link copied to clipboard
operator fun <T> SlotCapture<T>.getValue(thisRef: Any?, property: KProperty<*>): T?

Just like getIfPresent, but as a getValue operator.

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

Helper function to propagate capture for dev.mokkery.matcher.ArgMatcher.Composite.