Tip #2: To make your tests more specific and focus only on the class you are testing, mock everything else.
It is always observed that changes in one class cause other class’s tests to fail. This happens often because many other classes change when we change one class, leading to many other tests changing / breaking. It is always best to mock all other classes. That way, other classes are not actually used in the test, and you can ensure that your tests do not break! This also ensures that the only coverage we get is from the test written…