O'Reilly logo

Maven for Eclipse by Sanjay Shah

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

Writing unit tests

Writing unit tests is a part of good practice in software development. Maven's test phase executes unit tests and generates the corresponding report. In this section, we will learn about writing a simple unit test for our utility class ConversionUtil, and in the next section, we will see how to execute it and generate reports.

All the unit test classes should go under src/test/java. Create the corresponding folder in the MyDistance project. Once the folder is in place, right-click on it and navigate to New | Other.... Once the wizard window appears, type in junit in the Filter section, select JUnit Test Case, and click on Next, as shown in the following screenshot:

In the window to follow, define the unit test class by filling ...

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