Tag Archives: Junit  Test

import org.junit.Test And @ test error reporting — solutions

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.