Open ArbenMaloku opened 3 years ago
I'm trying to use argumentCaptor for inline function. Every time I run the test I'm getting captor.capture() must not be null. Any suggestion?
val captor = argumentCaptor<(Boolean) -> Unit>() @Before fun setUp() { MockitoAnnotations.openMocks(this) ... } @Test fun shouldTestSomething() { val captor = argumentCaptor<(Boolean) -> Unit>() viewModel.doSomething(stringParam, captor.capture()) }
You need to make your capture call in your verify not directly and you can't mix values and matchers at one verification
I'm trying to use argumentCaptor for inline function. Every time I run the test I'm getting captor.capture() must not be null. Any suggestion?