/**
* Parse a string which may be between double quotes.
* If it is between double quotes, the quotes are removed.
*
* @param input string
* @return cleaned string
*/
@ParameterType(".+|\".*\"")
public String quotableString(final String input) {
if (input.startsWith("\"") && input.endsWith("\"")) {
return input.substring(1, input.length()-1);
}
return input;
}
/**
* Parse an integer which may be between double quotes.
*
* @param input string
* @return cleaned integer
*/
@ParameterType("\\d+|\"\\d+\"")
public int quotableInteger(final String input) {
return Integer.parseInt(quotableString(input));
}
@When("I fill command form with alias {string} company {string} vat {quotableString} address {string} supp {string} zip {quotableInteger} city {string} country {string} phone {quotableString} and facturation {string} and submit")
public void fillCommand(final String alias,
final String company,
final String vat,
final String address,
final String supp,
final int zip,
final String city,
final String country,
final String phone,
final String facturation) {
…
} |