JUnit comes integrated with Eclipse, NetBeans and IntelliJ. You can write the JUnit tests manually, but these IDEs make it much easier. This example is using the IntelliJ IDEA. We start by adding a new project. Next, we will walk through the steps to create a unit test using the JUnit framework. After the unit test is created, we will run it successfully and then purposely introduce an error.
- [Instructor] The last IDE that I'm going to show you…is from JetBrains, it's called IntelliJ.…IntelliJ IDEA.…Let's start by creating a new project,…and then we'll add another unit test case to this project.…I'm gonna go ahead and say Create New Project.…In the top left I have Java already selected.…If this is the first time you're using IntelliJ,…you might not have your project SDK filled in.…If not, use the arrow and browse out to the folder…that contains your Java SDK.…
I'm gonna go ahead and click Next.…I'm not gonna create a project from a template,…and I don't want a command line app,…so I'm just gonna click Next and leave them deselected.…And the name of this is just going to be IntelliJExample.…And I'll click Finish.…As I stated before, each of the IDEs has…some slight differences in how you go about…creating and running your test cases.…But let's start by creating our class,…so we're gonna expand the IntelliJ project.…
And I'm gonna click on the Source folder,…and I'm gonna right-click or go to File,…
- What is JUnit?
- Comparing values with assertions
- Using JUnit with different Java IDEs
- Creating basic unit tests
- Testing for exception handling
- Creating parameterized tests