expectthrows专题

Junit5 expectThrows方法找不到的原因

在基于Junit5编写测试代码时,expectedThrows()方法找不到。 百度和google都没有答案,最后检索JUnit5官方文档得知: Deprecations and Breaking Changes: Removed deprecated Assertions.expectThrows() method in favor of Assertions.assertThrows().