For some types of development, for example, TDD, the best practice for testing is to write the test before writing the functionality for the application. This allows the developer to think carefully about the architecture of the application, and helps to ensure better test coverage.
NetBeans helps in this area by allowing developers to create test classes that are not based upon existing application code (this is the opposite of what we saw in the previous recipe, Creating a JUnit test for an existing class, where the application code already existed).
In this recipe, we'll see how to create a basic JUnit test class.
To complete this recipe, you need to ensure that you have installed the JUnit support into NetBeans as described in the earlier recipe, Installing JUnit support into NetBeans.
You'll also need the sample project we created in the previous recipe, Creating a JUnit test for an existing class. If you have not completed that recipe, the project is...