How to use Junit in Java
First, Junit refers to unit testing, which is used to test java programs. Can be used to test the code later
Second, how to use Junit
Naming convention: public void method name(){}
Third, the specific realization of the pace
- create java class
- Create a source folder file at the same level as src and create the same package name
2. Create another java class and write it on the method
@Test
3. Select the method name and there is a run as---JUnit Test in the right-click menu
The result is as follows: