spock.lang
@Retention(value=RUNTIME) @Target(value={TYPE,METHOD}) public @interface Unroll
@Unroll("#name should have length #length") def "name length"() { expect: name.size() == length where: name << ["Kirk", "Spock", "Scotty"] length << [4, 5, 6] }Alternatively, the naming pattern can also be embedded in the method name:
@Unroll def "#name should have length #length"() { ... }The
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 Unroll
. By embedding the naming pattern in the method
names, each method can still have its own pattern.public abstract String value