-
Notifications
You must be signed in to change notification settings - Fork 0
What are mocks
Devrath edited this page Jun 26, 2021
·
2 revisions
- Mocks are used to replace an interface
- Suppose we are using a retrofit service to call a web server. What we do is we call an abstract method of an interface and that calls a real server.
- Now using mocks
->
we mock a retrofit client->
then we call mock of retrofit to return the result of the mock
- Mocks are not used for checking the function behaviour and return values of the function.
- Mocks are used to check if a function is called or not
- Mocks are used to check how many times a function is called
- Check if the right parameters are passed or not
Mocks are used to check the right function is called with correct parameters and executed an exact number of times