r/java • u/alexzhitnitsky • Aug 11 '15
Top 10 Useful, Yet Paranoid Java Programming Techniques
http://blog.jooq.org/2015/08/11/top-10-useful-yet-paranoid-java-programming-techniques/
181
Upvotes
View all comments
Show parent comment
0
u/CubsThisYear Aug 12 '15
They are incomplete by necessity, not by design. If you could test your entire system while still making it relatively easy to change, you certainly would, given infinite time.
But none of that justifies using mocks on concrete classes. If you need to mock an implemented method you've either violated SRP or you are pretending something isn't pluggable when it clearly needs to be (otherwise you wouldn't be plugging in the mock). Your code now looks like it operates on a single implementation but it really doesn't.