<dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-api</artifactId> <version>5.7.2</version> <scope>test</scope> </dependency> import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertThrows; public class MyExceptionTest { @Test void testMyException() { assertThrows(MyException.class, () -> { }); } }


上一篇:
下一篇:
切换中文