Unit testing is straightforward despite the mountain of information on it. There is a lot of incorrect information on unit testing, too, such as a method being a unit. Have you ever come across a method outside of a class in
Java? In Java the
Unit is the class, so a formal unit test must mock out each external dependency (your other classes). If you were to unit test methods you would have to mock all the other class methods! That would be costly and misguided. I suggest
Mockito for mocking and
TestNG for running your tests. You mock external classes, you test all the public methods of the class-under-test. If there are protected/private methods that are not exercised by that, what are they doing there?
Now, lets back up a bit. You must also perform integration tests to ensure your classes work together. A good boundary for this is the tiers of your application. At a minimum,
you should not be making network or database calls as part of your integration tests. Nobody will lose any sleep if you loosely refer to these as "unit tests" but in fact they are integration tests. I would start with these "integration" tests if you are not used to TDD in general, then ease in to true unit tests. You will find it becomes easy, natural, and profitable to implement true unit tests. It can be a hard sell, especially to those who haven't actually done it, or don't really understand it.