IDEA测试类使用@RunWith注解时发现并没有这个注解,此时查看导入的test依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
解决办法:把代码删掉即可正常使用,既导入的test依赖如下
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
版权声明:本文为weixin_43777379原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。