Create and run JUnit 5 Test Case

This lessons focuses on creating and running JUnit 5 test cases in Maven.

Create a Java class

After adding the required dependencies, let’s create a Java class. It will be our class under test.

Step 1 - Expand the junit5-maven-starter project. In order to create a new Java class, right-click on src/main/java traverse to New --> Class. Click on Class to add a new Java class.

Step 2 - New Java Class popup window will be opened.

Step 3 - Provide Package name of your choice.

Step 4 - Enter Name of class as, Calculator.

Step 5 - Click Finish.

A Java class by name Calculator.java will be created in Eclipse IDE. See the demonstration of steps below.

Get hands-on with 1200+ tech skills courses.