如果出现以下单元测试 @Test爆红
第一种解决方案:
选中 alt+enter 点Add Maven dependency
选中下图第一个选项
之后再选中注解@Test 同时按alt + enter 便可解决
第二种解决方案
点击pom.xml文件
加入以下代码块:
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
</dependencies>
如图所示:
- 如果都不行,那就试试重启项目即可解决。