Recently, when I was working on a project with Spring Framework, I found that there were errors in import org.junit.test and @test. If there is no error in package import, the solution is as follows:



Solution 1:
MyEclipse right-click on the Build Path properties of the project and select the Add Libararies screen. Select JUnit to import. Eclipse does the same.
Solution 2:
The reason is that the package in which the Java file resides is anonymous by default.
a new com. XXX. XXX is the name of package, move Java file under the name with respect to ok
Solution 3:
The Java class for writing JUnit tests is named test.java, and if you must use test.java, you can only add @org.jUnit. Test
to the method
Solution 4:
The class name of this Test class should be changed to another class name instead of Test. I have encountered this problem many times because the class name was used Test. After the change, no error was reported normally.


Solution 1:
MyEclipse right-click on the Build Path properties of the project and select the Add Libararies screen. Select JUnit to import. Eclipse does the same.
Solution 2:
The reason is that the package in which the Java file resides is anonymous by default.
a new com. XXX. XXX is the name of package, move Java file under the name with respect to ok
Solution 3:
The Java class for writing JUnit tests is named test.java, and if you must use test.java, you can only add @org.jUnit. Test
to the method
Solution 4:
The class name of this Test class should be changed to another class name instead of Test. I have encountered this problem many times because the class name was used Test. After the change, no error was reported normally.
Read More:
- Spring integrates JUnit configuration
- Spring configuration transaction, JUnit unit test error “failed to load ApplicationContext”
- Common problems of Aidl cross process communication
- Idea error: error: Java: error: release 5 is not supported
- Compare whether two sets are the same in Java
- Android studio failed to resolve: junit:junit : 4.12 solutions
- Android appears java.lang.NoClassDefFoundError A solution to the error
- Maven skip unit test
- Related configuration of mybatis project
- [Jackson exception] com.fasterxml.jackson . databind.JsonMappingException Exception handling method
- Failed to determine a suitable driver class error in mybatis
- How to Fix “junit.framework.Comparison Failure Expected: but was”
- Spring error: ora-01017: invalid username / password; login denied
- Error: could not find or load main class
- Python scapy module installation and dependency module
- Spring boot running appears java.lang.IllegalStateException : Failed to load ApplicationContext
- Solution in idea java.lang.ClassNotFoundException : org.springframework.web . context.ContextLoaderListener
- Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0
- How to generate UML Diagrams from Java code in Eclipse
- ConfigurationProperties configuration class