3 ms·
It's test-friendly. The code may not have explicitly defined second implementation, but a simple "@Mock FooService" declaration in a test.
by ivan_gammel 8y ago
It's test-friendly. The code may not have explicitly defined second implementation, but a simple "@Mock FooService" declaration in a test.
- guitarbill 8y agoThis is a fair point, however in practice there's solution for that (Mockito, as long as the class isn't final). Which is how it should be. Your code shouldn't be untestable, on the other hand you shouldn't have to go out of your way to make it testable by adding more cruft.
- ivan_gammel 8y agoI don't think the design should be based on the requirement to use Mockito library and it's not the only and not always the most convenient way to provide a test implementation. So, no, it's not how it should be.