'I am trying to convert a java unittest case mockito to Kotlin MockK in android

This is the verify block and was working on java

verify(mockTokenError) {}

And later tried to convert to kotlin

verify{mockTokenError()}

also tried

verify{mockTokenError}

none of them works please let me know solution.



Solution 1:[1]

So the verify block checks all method calls (which were made with the mocked object) that are inside its block. For example,

val car = mockk<Car>()

verify { car.stop() }

More info - https://mockk.io/#verification-atleast-atmost-or-exactly-times

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Demigod