Lambda函数的代码覆盖率 [英] Code coverage for lambda function
本文介绍了Lambda函数的代码覆盖率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我具有带lambda函数的以下代码:
I have the following code with a lambda function:
obj.method(param, () -> {
//code here
})
如何通过测试代码覆盖在lambda函数中?
How can I cover by test the code in the lambda function?
推荐答案
您可以使用反射,但这可能容易出错并且适得其反。
You could use reflection, but this is likely to be error prone and counter productive.
我建议您调用使用lambda的方法。
I suggest you call the method which uses the lambda.
这篇关于Lambda函数的代码覆盖率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文