Package org.jbehave.core.steps
Class StepFinder
java.lang.Object
org.jbehave.core.steps.StepFinder
StepFinder is reponsible for finding and prioritising step candidates or
finding steps instances from CandidateSteps
, which are created using
an InjectableStepsFactory
.
The StepCandidate
s are responsible for the matching of a particular
textual step and are sometimes represented as Stepdoc
s, each of which
is simply a facade documenting a candidate. The candidates can be prioritised
via an injectable StepFinder.PrioritisingStrategy
, defaulting to
StepFinder.ByPriorityField
. A more sophisticated strategy that can be used is
the StepFinder.ByLevenshteinDistance
.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Strategy to priorise candidate steps by Levenshtein Distancestatic class
Strategy to priorise step candidates by theStepCandidate.getPriority()
field which is settable in theGiven
,When
,Then
annotations.static interface
Defines the priorising strategy of step candidates -
Constructor Summary
ConstructorDescriptionCreates a StepFinder with aStepFinder.ByPriorityField
strategyStepFinder
(StepConditionMatcher stepConditionMatcher) Creates a StepFinder with a custom step condition matcherStepFinder
(StepFinder.PrioritisingStrategy prioritisingStrategy) Creates a StepFinder with a custom strategy -
Method Summary
Modifier and TypeMethodDescriptionfindMatching
(String stepAsText, List<CandidateSteps> candidateSteps) Finds matching steps, represented asStepdoc
s, for a given textual step and a list ofCandidateSteps
.prioritise
(String stepAsText, List<StepCandidate> candidates) Prioritises the list of step candidates that match a given step.stepdocs
(List<CandidateSteps> candidateSteps) Returns the stepdocs for the candidates collected from the givenCandidateSteps
.stepsInstances
(List<CandidateSteps> candidateSteps) Returns the steps instances associated to CandidateSteps
-
Constructor Details
-
StepFinder
public StepFinder()Creates a StepFinder with aStepFinder.ByPriorityField
strategy -
StepFinder
Creates a StepFinder with a custom strategy- Parameters:
prioritisingStrategy
- the PrioritisingStrategy
-
StepFinder
Creates a StepFinder with a custom step condition matcher- Parameters:
stepConditionMatcher
- the StepConditionMatcher
-
-
Method Details
-
stepdocs
Returns the stepdocs for the candidates collected from the givenCandidateSteps
.- Parameters:
candidateSteps
- the List of CandidateSteps- Returns:
- The List of Stepdocs, one for each
StepCandidate
.
-
findMatching
Finds matching steps, represented asStepdoc
s, for a given textual step and a list ofCandidateSteps
.- Parameters:
stepAsText
- the textual stepcandidateSteps
- the List of CandidateSteps- Returns:
- The list of Stepdocs, one for each matched
StepCandidate
.
-
stepsInstances
Returns the steps instances associated to CandidateSteps- Parameters:
candidateSteps
- the List of CandidateSteps- Returns:
- The List of steps instances
-
prioritise
Prioritises the list of step candidates that match a given step.- Parameters:
stepAsText
- the textual step to matchcandidates
- the List of StepCandidate- Returns:
- The prioritised list according to the
StepFinder.PrioritisingStrategy
.
-