Answer
An answer for a function call.
call with MokkeryBlockingCallScope is invoked on blocking function call.
call with MokkerySuspendCallScope is invoked on suspending function call.
Tips for providing correct implementation:
If you want to provide the same implementation for both blocking and suspending call, implement Answer.Unified instead.
If you want your answer to support only blocking or suspending calls, implement Answer.Blocking or Answer.Suspending.
Implement pure Answer if you want implement both methods separately.
Answers should not be used directly. It's a good practice to provide extension based API.
Check existing answers implementations for samples.
Inheritors
Types
Used whenever there is no defined answer for a call to mock that is in dev.mokkery.MockMode.autofill. Refer to AutofillProvider.forMockMode to read more about returned values.
Just like Block but for suspending functions.
Interface for every answer that have to be called in repeat when specified in sequentially.
Returns results of answers from iterator until empty. It supports nested Sequential answers and calls them until they are empty.
Convenience interface for suspend only answers. By default, it throws runtime exception on blocking call.
Functions
Returns human-readable answer description. By default, it returns answers $this. It's used for debugging purposes.