I need to mock a call to some class and make it take some time.
The current code uses this:
every { useCase.execute(any()) } answers {
AnswersWithDelay(50000, DoesNothing.doesNothing())
}
Now I am changing execute()
to return an object of Notification
class.
val notif = Notification(...)
But I can't figure out how to change this mock.
val answer: org.mockito.stubbing.Answer<Notification> = AdditionalAnswers.answer { invocation: InvocationOnMock -> notif }
val delayedAnswer = AdditionalAnswers.answersWithDelay(50000, { invocation: InvocationOnMock -> answer } )
I can't find how to make the answers { ... }
compilable. Any tips?