Mocking Test Methodology
The key idea of mocking is to replace real code (e.g. calls to a database or service) with artificial functionality that has the same return type. There are different approaches to this practice. Here, I explain best practices and why it might be better to avoid mocking to have real code quality.
User Service — Example to Be Tested With Mocks
Let's write a simple application that fetches users from HTTP service.