Dp4j is a Java tool that let's you test private methods as if they were not private, because dp4j will analyze your test code and generate the necessary Java code to access the private methods and make your JUnit test compile. Robust and hassle-free!
DP4J USAGE DEMO
No time to read more?! Want to try it right away? Open a Unix terminal and execute this command:
wget http://sourceforge.net/projects/dp4j/files/1.2/TESTDRIVE ; chmod +x TESTDRIVE ; ./TESTDRIVE
DP4J FOR THE SINGLETON DESIGN PATTERN
You can also use dp4j to implement the Singleton design pattern in Java by using the class annotation @Singleton. Find out more here.