I have the following in my story that I am trying to match
!-- Block 1
When I "action" of document "document" to "status" and nextAction
When I "action" for document "document" to "status" and nextAction
When I "action" document "document" to "status" and nextAction
!-- Block 2
When I "action" of document "document" and nextAction
When I "action" for document "document" and nextAction
When I "action" document "document" and nextAction
!-- Block 3
When I "action" of document "document" to "status"
When I "action" for document "document" to "status"
When I "action" document "document" to "status"
!-- Block 4
When I "action" of document "document"
When I "action" for document "document"
When I "action" document "document"
Between "action" and document there may be of, for or empty to "status" is optional and nextAction is optional
In the steps file I have the following
@When ("I \"$action\"{| of| for} document \"$document\"{ to \"$status\"|}{ and $nextAction|}")
This is matching blocks 1 and 2 but not blocks 3 and 4 from the story file.
Can you give me some pointers as to how I need to amend the steps file to be able to match all 4 blocks?
I have tried adding aliases with the to status and the and next action removed however JBehave errors with a duplicate candidate steps error.
Thank you
If the only variation is the 2x2 grid of options on (to "status") included or not and (nextAction) included or not - then I would just have the 4 annotated methods with the "of|for" variant. Then have all those methods call into the one method (unannotated).
That will be much cleaner than using variants to include/exclude whole phrases.
Also most of the JBehave folks don't watch StackOverflow so I'd ask the user list as well.