Book Image

NetBeans IDE 8 Cookbook

By : David Salter, Rhawi Dantas
Book Image

NetBeans IDE 8 Cookbook

By: David Salter, Rhawi Dantas

Overview of this book

<p>From the start to the end of a Java project's lifecycle, this book will show you how to perform many key tasks with the NetBeans IDE, uncovering more about mobile, desktop, and enterprise Java along the way.</p> <p>You will start by creating Java projects and learning how to refactor and use NetBeans tools to increase developer efficiency. You will then get a walkthrough of how to create a desktop application before covering JavaFX and mobile applications and how to use external services within them. Having seen how to create many different types of applications, you will then be shown how to test and profile them before storing them in revision control systems such as Git or Subversion. Finally, you will learn how to extend NetBeans itself by adding new features to the IDE.</p>
Table of Contents (19 chapters)
NetBeans IDE 8 Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a JUnit test


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.

Getting ready

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...