【JUnit】JUnit 4 和 JUnit 5 在测试类中不同的用法 杜小舟 2024-07-23 48 阅读1分钟 @[TOC] JUnit 4 在测试类中加上 @SpringBootTest @RunWith(SpringJUnit4ClassRunner.class) public class DemoTest { } JUnit 5 在测试类中加上 @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class DemoTest { }