@Retention(value=RUNTIME) @Target(value={PARAMETER,ANNOTATION_TYPE}) public @interface Delimiter
This annotation can be specified on step definition method parameters to give Cucumber a hint about how to transform a String to a list of objects. For example, if you have the following Gherkin step:
Given the users adam, bob, john
Then the following Java Step Definition would convert that into a List:
@Given("^the users ([a-z](?:, [a-z]+))$") public void the_users(@Delimiter(", ") List<String> users) { this.users = users; }
This annotation also works with regular expression patterns. Step definition method parameters of type
List
without the Delimiter
annotation will default to the pattern ",\\s?"
.
public abstract String value
Copyright © 2017. All rights reserved.