Migrating from Mockito #

Learn how to use MockK by seeing equivalents to functions in Mockito.

Create a mock
The similarities and differences in creating mocks between Mockito and MockK.
`when` and `do*`
when(x).thenReturn(y), doReturn, and more.
Mockito’s eq, refEq, and same argument matchers.
The “any” family of matchers: any, anyBoolean, anyByte, anyChar, anyDouble, anyFloat, anyInt, anyLong, anyObject, anyShort, and anyString.
verify that a method was called.
Porting custom matchers with argThat
Capturing arguments to check them later.
`void` methods
MockK makes it easier to mock methods that return void.
Buy Me a Coffee at ko-fi.com