kotlin and ArgumentCaptor - IllegalStateException

后端 未结 8 1338
长发绾君心
长发绾君心 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条回答
  •  旧时难觅i
    2020-12-30 18:57

    You can write a wrapper over argument captor

    class CaptorWrapper(private val captor:ArgumentCaptor, private val obj:T){
        fun capture():T{
            captor.capture()
            return obj
        }
    
        fun captor():ArgumentCaptor{
            return captor
        }
    }
    

提交回复
热议问题