龙目岛(Lombok),仅使用getter setter而不是等于或tostring [英] Lombok, use only getter setter not equals or tostring
问题描述
因为我们不使用tostring
或equals
,它减少了coverage
.
Because we dont use tostring
or equals
and it reduces coverage
.
所以我们需要为tostring
,equals
有什么办法吗?
对于吸气剂
@Getter(AccessLevel.NONE)
我可以这样做,但是对于其他人,我该怎么办?
i can do this but for others, what can i do?
据我了解,
@lombok.Accessors(chain = true, fluent = true)
这也适用于吸气剂设置器
this is also for getter setter
推荐答案
我不知道您在使用什么保险,但是我们启用了lombok设置,以防止它影响我们的保险范围.在项目的顶层创建一个 lombok.config 文件:
I don't know what you're using for coverage, but we have enabled a lombok setting that prevents it from affecting our coverage. Create a lombok.config file at the top level of your project with this:
config.stopBubbling = true
lombok.addLombokGeneratedAnnotation = true
第一行是可选的;它只是告诉lombok停止搜索其他配置文件.第二行使lombok向其创建的方法添加注释,以将其标记为lombok生成.对于我们使用的覆盖率工具,jacoco可防止其在计算覆盖率时考虑这些方法.
The first line is optional; it just tells lombok to stop searching for other config files. The second line causes lombok to add an annotation to the methods it creates marking them as being lombok generated. For the coverage tool we use, jacoco, that prevents it from taking these methods into consideration when calculating the coverage.
这篇关于龙目岛(Lombok),仅使用getter setter而不是等于或tostring的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!