3 ms·
When code is written to interfaces those interfaces can be mocked without mocking frameworks. Mocking frameworks mask poorly structured code.
by 0x445442 3y ago
When code is written to interfaces those interfaces can be mocked without mocking frameworks. Mocking frameworks mask poorly structured code.
- piva00 3y agoThen you have to reimplement method call count when you need to assert something was called in your interface-based mock; and reimplement differing returns based on input or call count; and maybe reimplement throwing exceptions when those are necessary to test not-so-happy paths. In the end you'll have an implementation of the interface with quite complex logic in the methods' implementation to handle differing returns, which will couple your mock implementation to the test cases setup, or you'll reimplement a mocking framework. I prefer to use a mocking framework to deliver stuff instead of stabbing myself to keep purity of interface-based APIs.
- pc86 3y agoYou just rephrased "issues in a code base's architecture" as "mask poorly structured code" without saying how.