VarArgMatcher
Deprecated
Obsolete varargs API. Read `VarArgMatcher` docs for more details.
Wildcard vararg matcher that checks a subset of varargs. It can occur only once. To provide your own implementation use Base.
Vararg matchers are DEPRECATED
Since Mokkery 3, it is possible to use any matcher that accepts an array with the spread operator (*), making vararg matchers obsolete. They have been replaced with matchers that are more versatile and can be used with arrays in any context.
Examples:
// Mokkery 2
every { mock.callWithVarargs(1, *anyIntVarargs(), 10) } returns 1
every { mock.callWithVarargs(1, *varargsIntAll { it % 2 == 0 }, 10) } returns 1
// Mokkery 3
every { mock.callWithVarargs(1, *any(), 10) } returns 1
every { mock.callWithVarargs(1, *containsAllInts { it % 2 == 0 }, 10) } returns 1The new approach allows you to easily create custom matchers and use them with the spread operator:
every { mock.callWithVarargs(1, *matches { it.size > 2 }, 10) } returns 1
// Matches a call with varargs that starts with 1, ends with 10, and has at least two elements in between.Inheritors
Types
Matches any sequence of varargs.
Base class for any VarArgMatcher. Returns false if arg is not an array or list.
Functions
Helper function to propagate capture for dev.mokkery.matcher.ArgMatcher.Composite.