-
-
Notifications
You must be signed in to change notification settings - Fork 9
Closed
Labels
enhancement 🚀New feature or requestNew feature or request
Description
I would like to see a global call back mechanism to monitor calls to mocks and possibly even modify the behavior.
One use for this would be for logging. In complex cases where the SUT is interacting with multiple mocks it is helpful to debug to see what parameters were passed to the mock and what the mock is returning via logging.
It would also provide a way to handle my request in #20
As I see it at the minimum such a callback interface could look like:
interface MockCallback {
fun called(scope: FunctionScope, result: Result<Any>) : Result<Any>
suspend fun calledSuspend(scope: FunctionScope, result: Result<Any>) : Result<Any> = called(scope, result)
}
This lets you:
- know when a mock is called and can log it
- override the return value
- add additional behavior such as blocking the return from the function
Metadata
Metadata
Assignees
Labels
enhancement 🚀New feature or requestNew feature or request