Returns Unit for functions that return Unit, otherwise fails.
For generic types, the default return value will be Unit
based on the specified type argument (e.g., mock<() -> Unit>(autoUnit).invoke()
returns Unit
instead of null
). Mokkery achieves this by preserving type arguments at runtime.