title: What to do when Java Best Practices conflict with Mockito
body: <p>My development team has started to use <a href="http://mockito.org/" rel="nofollow noreferrer">Mockito</a> and have classes that have been defined as 'final'.  I've read in Effective Java by Joshua Bloch and in the SO thread <a href="https://stackoverflow.com/questions/154314/when-to-use-final">When to use final</a> that all classes should use the final modifier.  There have been some disagreement in the thread, but I do agree with the idea of forcing class composition unless inheritance makes sense.</p>
  
  <p><strong>What should I do when I want to test classes using a testing framework like Mockito that requires classes to not have the 'final' modifier?</strong>  I'm hoping someone else has encountered similar issues during their development.  What resolutions did your development team arrive on?</p>
  
  <p>There are two obvious answers such as using JMock or remove the 'final' modifier on the classes we want to test, but we want to stick with one external testing framework (besides JUnit) and it may be hard to convince other developers to remove the 'final' modifier.</p>
  
  <p>Thanks.</p>