The usage of Java JUnit unit test and the solution of initialization error

1. Select project – right click – build path – add Libraries – JUnit – next – junit4 – finish
2. Write @ test on the method body to be tested

1. The test method must be modified with public
2. The return value must be void
3. There can be no parameters in the method
4. There can be no class named test under the package
if the test code is OK, an error is still reported, initialization error is not reported in other classes,
it may be because there is an error method in this class
2 Or there are multiple @ test annotations in a class, one of which adds static or has other errors.

Read More: