Annotations are not allowed here

Problem Description:

Annotations are not allowed here
when developing with idea, if a unit test is created manually instead of using the method provided by IDE, this error will be reported because the annotation is not fully imported (even if the package is imported)

resolvent:

First, create a unit test class by using the steps provided by ide to create a unit test class for a class

Right click the class code that needs to create the unit test class – & gt; go to – & gt; test

Shortcut key: Ctrl + Shift + T

After creating one, you can create a new test class in the Java / test directory.

 

 

Read More: