Clone this wiki locally
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 (find out how it works).
DP4J USAGE DEMO
No time to read more?! Want to try it right away? Open a Unix terminal and execute the following command. It will download and run the TESTDRIVE script documented here.
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.