Throwable
从未实际抛出时,报告 Throwable
或其子类的实例化。
报告的代码指出了测试中难以捕获的错误。
此外,当结果 Throwable
实例未抛出时,此检查会报告返回 Throwable
或其子类实例的方法调用。
示例:
fun check(condition: Boolean) {
if (!condition) /* throw is missing here */ IllegalArgumentException("condition is not met");
}
fun createError() = RuntimeException()
fun foo() {
/* throw is missing here */ createError()
}