Package org.jbehave.core.steps
Class StepFinder
- java.lang.Object
-
- org.jbehave.core.steps.StepFinder
-
public class StepFinder extends Object
StepFinder is reponsible for finding and prioritising step candidates or finding steps instances from
CandidateSteps, which are created using anInjectableStepsFactory.The
StepCandidates are responsible for the matching of a particular textual step and are sometimes represented asStepdocs, each of which is simply a facade documenting a candidate. The candidates can be prioritised via an injectableStepFinder.PrioritisingStrategy, defaulting toStepFinder.ByPriorityField. A more sophisticated strategy that can be used is theStepFinder.ByLevenshteinDistance.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStepFinder.ByLevenshteinDistanceStrategy to priorise candidate steps by Levenshtein Distancestatic classStepFinder.ByPriorityFieldStrategy to priorise step candidates by theStepCandidate.getPriority()field which is settable in theGiven,When,Thenannotations.static interfaceStepFinder.PrioritisingStrategyDefines the priorising strategy of step candidates
-
Constructor Summary
Constructors Constructor Description StepFinder()Creates a StepFinder with aStepFinder.ByPriorityFieldstrategyStepFinder(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 Type Method Description List<Stepdoc>findMatching(String stepAsText, List<CandidateSteps> candidateSteps)Finds matching steps, represented asStepdocs, for a given textual step and a list ofCandidateSteps.List<StepCandidate>prioritise(String stepAsText, List<StepCandidate> candidates)Prioritises the list of step candidates that match a given step.List<Stepdoc>stepdocs(List<CandidateSteps> candidateSteps)Returns the stepdocs for the candidates collected from the givenCandidateSteps.List<Object>stepsInstances(List<CandidateSteps> candidateSteps)Returns the steps instances associated to CandidateSteps
-
-
-
Constructor Detail
-
StepFinder
public StepFinder()
Creates a StepFinder with aStepFinder.ByPriorityFieldstrategy
-
StepFinder
public StepFinder(StepFinder.PrioritisingStrategy prioritisingStrategy)
Creates a StepFinder with a custom strategy- Parameters:
prioritisingStrategy- the PrioritisingStrategy
-
StepFinder
public StepFinder(StepConditionMatcher stepConditionMatcher)
Creates a StepFinder with a custom step condition matcher- Parameters:
stepConditionMatcher- the StepConditionMatcher
-
-
Method Detail
-
stepdocs
public List<Stepdoc> stepdocs(List<CandidateSteps> candidateSteps)
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
public List<Stepdoc> findMatching(String stepAsText, List<CandidateSteps> candidateSteps)
Finds matching steps, represented asStepdocs, 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
public List<Object> stepsInstances(List<CandidateSteps> candidateSteps)
Returns the steps instances associated to CandidateSteps- Parameters:
candidateSteps- the List of CandidateSteps- Returns:
- The List of steps instances
-
prioritise
public List<StepCandidate> prioritise(String stepAsText, List<StepCandidate> candidates)
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.
-
-