
The Test annotation supports two optional parameters. The first, expected, declares that a test method should throw an exception. If it doesn't throw an exception or if it throws a different exception than the one declared, the test fails。
The second optional parameter, timeout, causes a test to fail if it takes longer than a specified amount of clock time (measured in milliseconds).
Two @test parameters in Junit
最新推荐文章于 2023-10-25 19:33:21 发布
本文介绍了测试注解中两个可选参数的功能:expected 和 timeout。expected 参数声明了测试方法应该抛出的异常类型,若未抛出预期异常或抛出其他异常则测试失败;timeout 参数用于设置测试方法的最大运行时间,超出该时间将导致测试失败。
2093

被折叠的 条评论
为什么被折叠?



