The matching of candidate steps to textual steps is central to JBehave's design. The first candidate step that matches is used to create an executable step. In some case, though, one can have cases in which multiple candidate steps can match the same textual step, e.g. when the steps are very similar.
In these cases, JBehave allows to specify a specific PrioritisingStrategy in the StepFinder. The default strategy is ByPriorityField which prioritises the steps by the priority field explicitly set in the Given/When/Then annotations.
PrioritisingStrategy strategy = new ByPriorityField(); StepFinder stepFinder = new StepFinder(strategy);