The mistake was that you spent time writing JMock unit tests when we currently use Mockito. Having all the code in ``XWikiDocument`` (which is hard to test) didn't help either. On our side we need to advertise more that we dropped JMock in favor of Mockito. As for:

> In my opinion, unit tests should be written by another developer (at least, that's what I learned for best practices)

I completely disagree! Developers need to write unit tests for the code they provide, preferably before they write the actual code (TDD), to prove their code works. Unit tests need to cover as many execution paths as possible and for this you need to know the code and the developer that wrote the code knows best. Not to mention that tests show you if the code was well written design-wise and they serve as documentation.