Hello. I am trying to mock a function `TaskProcess...
# announcements
w
Hello. I am trying to mock a function
TaskProcessor.start(job: Job)
and verify argument with which it has been invoked.
Copy code
val argumentCaptor: ArgumentCaptor<Job> = ArgumentCaptor.forClass(Job::class.java)
Mockito.verify(mockTaskProcessor).start(argumentCaptor.capture())
That gives me an IllegalStateException when run, because Mockito is using
null
as an mock arguments, and that obviously is against Kotlin's safety policy. I could relax function definition
TaskProcessor.start(job: Job?)
but I'm loosing all Kotlin's advantage in terms of null safety. What would be the best method to capture and verify mocked arguments?