I think this is a useful addition as it takes benefit of a language feature instead of calling the (arguably) more verbose option of calling the getArgument<T>(i) method on the invocation:
on { intResult(any()) } doAnswer { (i: Int) -> i * 2 }
instead of (still supported):
on { intResult(any()) } doAnswer { it.getArgument<Int>(0) * 2 }
I think this is a useful addition as it takes benefit of a language feature instead of calling the (arguably) more verbose option of calling the
getArgument<T>(i)
method on the invocation:instead of (still supported):