Usage:
1. Select project – right click – build path – add Libraries – JUnit – next – junit4 – finish
2. Write @ test on the method body to be tested
Note:
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:
- import org.junit.Test And @ test error reporting — solutions
- Spring integrates JUnit configuration
- Compare whether two sets are the same in Java
- Related configuration of mybatis project
- An error is reported when springboot starts: error creating bean with name ‘XXXX’
- Annotations are not allowed here
- non-static variable this cannot be referenced from a static context
- SFINAE of C++ idioms
- Android appears java.lang.NoClassDefFoundError A solution to the error
- The difference between classnotfoundexception and NoClassDefFoundError
- Error: Could not find or load main class ***
- Encapsulation of adding, deleting and modifying database by JDBC
- Java gets the type t.class of generic t
- JAVA lambda Syntax error on tokens, Expression expected instead
- The method of Java jumping out of loop
- How to use C + + function pointer array
- Java retainAll throws an unsupported operation exception record
- Spring MVC 406 status code / could not find acceptable representation
- Error c2259 cannot instance abstract class due to following members
- Spring configuration transaction, JUnit unit test error “failed to load ApplicationContext”