Reputation: 21
I'm use MockK for unit test. How i can mockk private call with nullable and not nullable args?
My method:
private fun trySaveLogin(session: Session, login: String, passwordHash: String?, passwordHashNoSalt: String?, userInfo: UserInfo) { // doWork}
Already tried:
every { loginPresenter["trySaveLogin"](allAny<Any>()) } just Runs
every { loginPresenter["trySaveLogin"](any<String>(), any<String>(), any<String>(), any<String>(), any<UserInfo>()) } just Runs
Everything return error :
io.mockk.MockKException: can't find function trySaveLogin(-4d6de1423b10ebb8, ...) for dynamic call
Upvotes: 2
Views: 3163
Reputation: 73
Use this:
every { loginPresenter["trySaveLogin"](any<Session>(), any<String>(), any<String>(), any<String>(), any<UserInfo>()) as Unit } just Runs
Upvotes: 2