Open cjacky475 opened 1 year ago
Hello, I have this function:
override fun loadSensors(userId: String, param: (Result<MutableList<UserSensor>>) -> Unit) { // Blank }
@get:Rule var hiltRule = HiltAndroidRule(this) @Rule @JvmField var mockitoRule = MockitoJUnit.rule() @Inject lateinit var repository: MockRepositoryImpl @Before fun before() { hiltRule.inject() MockitoAnnotations.openMocks(this) `when`(repository.loadSensors(anyString(), any())).thenAnswer { Result.Success("", mutableListOf(UserSensor(0), UserSensor(1))) } ActivityScenario.launch(MainActivity::class.java) }
How to mock that thenAnswer would actually call my param argument?
thenAnswer
param
Are you asking about InvocationOnMock?
InvocationOnMock
Hello, I have this function:
How to mock that
thenAnswer
would actually call myparam
argument?