My pages will tell you how to use unit test and test coverage in IntteliJ.

1.At first we need to create a java program.

2.create a class named Triangle and then right a method to 

calculates whether the triangle is equilateral, isosceles, or scalene.

3.add the junit and hamcrest jar package to the program

the intelliJ has the package in it lib

4. create a floder named TestTriangle and add root as a Test Sources Root

5. choose the Triangle class in editer,and use ctrl+shift+T to crate  a test class

6.write the test method to test the method in Triangle class.

7.to run the test we can click right point and choose Run"TriangleTest" or point Run

this is the result of the test

if we want to change run configurations we can by Run->Edit Configurations

8.the last is to use coverage test we can

use it by Run -> Run'TriangleTest'with coverage 

the result as follow