All Downloads are FREE. Search and download functionalities are using the official Maven repository.

spock.lang.Unroll Maven / Gradle / Ivy

Go to download

Spock is a testing and specification framework for Java and Groovy applications. What makes it stand out from the crowd is its beautiful and highly expressive specification language. Thanks to its JUnit runner, Spock is compatible with most IDEs, build tools, and continuous integration servers. Spock is inspired from JUnit, jMock, RSpec, Groovy, Scala, Vulcans, and other fascinating life forms.

There is a newer version: 2.4-M4-groovy-4.0
Show newest version
package spock.lang;

import java.lang.annotation.*;

/**
 * Indicates that iterations of a data-driven feature should be made visible
 * as separate features to the outside world (IDEs, reports, etc.). By default,
 * the name of an iteration is the feature's name followed by the data variables
 * and their values and the iteration index.
 * This can be changed by providing a naming pattern after @Unroll. A naming pattern
 * may refer to data variables by prepending their names with #. Example:
 *
 * 
 * @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 {@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. * *

Having {@code @Unroll} on a super spec does not influence the features of sub specs, * that is {@code @Unroll} is not inheritable. * * @author Peter Niederwieser */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE, ElementType.METHOD}) public @interface Unroll { String value() default ""; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy