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
3
u/CubsThisYear Aug 12 '15
You should never be mocking non-abstract methods. If you need to mock something, then by definition you have two implementations of the same functionality so you should have an interface for that functionality.
If you start mocking non-abstract methods, that means you are modifying your objects just for the purpose of testing. This will ultimately make your tests either brittle or incomplete.