Most of the time the software unit you develop depends on other units, which are still under development or planning. To be able to test your unit probably, you need the collaborating parts of the application or you can use mock objects. Easymock provides mock objects, which enables you to test your unit in isolation. All you need are interfaces of the units your software depends on.
I made a small example testing a simple application with easymock and JUnit. It’s available through blogtorrent and my download site.