grails - Spock @Unroll 注释

标签 grails grails-2.0 spock

在最近的代码审查中,出现了关于 @Unroll 注释属于类级别还是方法级别的问题。该类的大多数方法(但不是全部)都需要 @Unroll。如果在类级别声明并且并非类的所有方法都需要它,声明 @Unroll 是否会导致任何性能损失?

最佳答案

@Unroll 注释旨在用于方法级别。但它也可以在类级别上使用,如 Unroll.java JavaDoc comments 中所示。 :

The {@code Unroll} annotation can also be put on a spec class. This has the same effect as putting it on every data-driven feature method that is not already annotated with {@code Unroll}. By embedding the naming pattern in the method names, each method can still have its own pattern.

关于grails - Spock @Unroll 注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30577376/

相关文章:

grails - 如何更改我的 View 文件以获得适当的输出?

session - Grails session 变量为null

ajax - AJAX 调用后如何在 Grails 中显示 flash.message

testing - 当 Spock 测试失败时执行一些操作

unit-testing - 有什么办法可以使用GORM在模拟域对象中设置ID

grails - Spock不执行when子句

unit-testing - 如何在Grails 2.1.1中模拟createCriteria()?

java - Grails 应用程序部署的最佳应用程序服务器是什么?

注销后 Grails Spring 安全重定向

grails - Grails中的自定义域约束