A Java adapter for MockK tool.
Features:
-
mockk
-
spyk
-
spyk(Person(name()))
: use the target constructor -
mockkStatic
-
unmockkStatic
-
mockkObject
-
unmockkObject
-
every { }
->when()
- public methods
- private methods
- static methods
- methods of object
-
returns { }
->thenReturn()
- mock fields
- field in class
- static field
- field in object
Robustness:
- Multiple every
- Use more complex parameter types and return types
- Use JMockK in real android projects
We need the
answers
method to support the fields mocking.