In cucumber (java version), how do I match all steps with one "then" function?
For example I would like to be able to match all the following in one function:
Then the response status will be "200"
Then the response status will be "200" or "302"
Then the response status will be "200" or "302" or "404"
Do I need to write a matcher for each of the "or"s?
Is there a way that I could write one matcher for all of the cases above?
For example, how do I combine these into one function?:
@Then("^the response status should be \"([^\"]*)\"$")
public void the_response_status_should_be(String arg1) throws Throwable {
System.out.println("** the response status should be "+arg1);
}
@Then("^the response status should be \"([^\"]*)\" or \"([^\"]*)\"$")
public void the_response_status_should_be_or(String arg1, String arg2) throws Throwable {
System.out.println("** the response status should be "+arg1+" "+arg2);
}
@Then("^the response status should be \"([^\"]*)\" or \"([^\"]*)\" or \"([^\"]*)\"$")
public void the_response_status_should_be_or(String arg1, String arg2, String arg3) throws Throwable {
System.out.println("** the response status should be "+arg1+" "+arg2+" "+arg3);
}
Is this possible?
Thanks!