我正在使用MockK进行单元测试。我如何使用可为空和不可为空的arg嘲笑私人电话?
我的方法:
private fun trySaveLogin(session: Session, login: String, passwordHash: String?, passwordHashNoSalt: String?, userInfo: UserInfo) { // doWork}
已经尝试:
every { loginPresenter["trySaveLogin"](allAny<Any>()) } just Runs
every { loginPresenter["trySaveLogin"](any<String>(), any<String>(), any<String>(), any<String>(), any<UserInfo>()) } just Runs
所有返回错误:
io.mockk.MockKException: can't find function trySaveLogin(-4d6de1423b10ebb8, ...) for dynamic call
答案 0 :(得分:1)
使用此:
every { loginPresenter["trySaveLogin"](any<Session>(), any<String>(), any<String>(), any<String>(), any<UserInfo>()) as Unit } just Runs