Book Image

IntelliJ IDEA Essentials

By : Jaroslaw Krochmalski
Book Image

IntelliJ IDEA Essentials

By: Jaroslaw Krochmalski

Overview of this book

Table of Contents (17 chapters)
IntelliJ IDEA Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating the test


To create the unit test for your class, choose Test from the Navigate menu. Alternatively, you can use the Ctrl + Shift + T (PC) or cmd + Shift + T (Mac) keyboard shortcut. If the class you have open in the editor doesn't have any unit tests, the Create New Test dialog box will pop up asking you to create one as shown here:

Depending on the plugins installed, the Testing library list will differ. Select the desired library from the list. The libraries for JUnit and TestNG are shipped with IntelliJ IDEA. Unless you have the testing dependencies defined in your Maven build file, these libraries will not be included in the classpath of your project or module by default. IntelliJ IDEA will warn you about this—you can fix this by clicking on the Fix button. The needed library will then be included to the module classpath. If you skip this step, the references to the testing library classes and annotations will not be resolved. In this case, you can do it later in the editor,...