NetBeans can easily automate the task of creating skeleton unit tests for our classes.
In this process the IDE can write an entire unit class based on the available methods of some code. This class can be given different configurations with just a single click.
NetBeans integrates by default two different versions of JUnit by default. It is up to the developer to choose the most familiar one.
The biggest difference between versions is that JUnit 4 relies heavily on features introduced by Java 5, such as generics and annotations. Be aware that to use JUnit 4 the minimum JDK requirement is version 5.
For this recipe we will need a Java class with testable methods.
To start with JUnit we will need a Java project: