Thursday, 22 August 2013

How to use non-capturing parenthesis to capture a word or nothing at all?

How to use non-capturing parenthesis to capture a word or nothing at all?

I am looking to use two variations of the same step I'm my ATDD test using
cucumber-jvm
Then order passes quantity limits
and
Then order passes limits
This will read better with different scenarios. I have tried various
variations of the following:
@Then(value = "^order passes (?: | quantity )limits$")
public void verifyCreditPassed(){
//Assert stuff
}
Can anyone help?
Thanks

No comments:

Post a Comment