Spock @Unroll annotation

放肆的年华 提交于 2019-12-24 03:50:42

问题


During a recent code review, the question came up regarding whether the @Unroll annotation belongs at the class level or the method level. The class in question requires @Unroll on most of its methods but not all of them. Does declaring @Unroll incur any performance penalties if declared at the class level and not all methods of the class require it?


回答1:


The @Unroll annotation is intended to be used on the method level. But it can also be used on the class level as indicated in the 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.



来源:https://stackoverflow.com/questions/30577376/spock-unroll-annotation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!