Right. You must mock things that depend on something permanent or external in order to prevent checking dependency on something permanent or external.
If the dependency does not depend on anything permanent or external, the only advantage you get from ridicule is that the test will work correctly, even if the dependency is incorrect, but it is assumed that the layout works correctly. To do this, you need to either:
The first option is frankly ridiculous - why should your layout be better than the original dependency? In the end, it would be safe to assume that much more effort was put into the original dependency than to the layout ...
The second option means that your layout knows the exact details of the implementation, otherwise you wonโt know how the implementation uses the dependency, so you donโt know how to simulate these specific uses. This means that the test does not serve one of the main goals of unit tests - checking the correct operation of the code after changes in the implementation.
The disadvantages of ridicule are too great, and the advantages are too small - especially considering that you can always run dependency tests to see if they work correctly ...
source share