kotlin and ArgumentCaptor - IllegalStateException

后端 未结 8 1363
长发绾君心
长发绾君心 2020-12-30 18:44

I have a problem with capturing the Class argument via ArgumentCaptor. My test class looks like this:

@RunWith(RobolectricGradleTestRunner::class)
@Config(sd         


        
8条回答
  •  臣服心动
    2020-12-30 19:05

    For some, there is a file, MockitoKotlinHelpers.kt provided by Google in the Android Architecture repo. It provides a convenient way to call capture.. just call verify(activityHandlerMock).navigateTo(capture(classCaptor), capture(booleanCaptor))

    Update: If the above solution does not work for you, please check Roberto Leinardi's solution in the comments below.

提交回复
热议问题