O'Reilly logo

NetBeans IDE 7 Cookbook by Rhawi Dantas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating unit tests

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.

Getting ready

For this recipe we will need a Java class with testable methods.

To start with JUnit we will need a Java project:

  1. Create ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required