【JUnit】@Test 报错,"Test cannot be resolved to a type"

想用单元测试 JUnit 单元测试下写好的方法,发现写 @Test 标签报错了,"Test cannot be resolved to a type" 原来是项目没有导入 JUnit 库,解决办法很简单 项目右键 -> Build Path -> Configure Build Path -> Libraries -> Add Library -> JUnit -> next -> finish OK,问题解决了。 记录下免得下次给忘了。

原文地址:https://www.cnblogs.com/imsoft/p/4802664.html