Search in sources :

Example 1 with Steps

use of org.jbehave.core.steps.Steps in project jbehave-core by jbehave.

the class AnnotationBuilderBehaviour method assertThatStepsInstancesAre.

private void assertThatStepsInstancesAre(List<CandidateSteps> candidateSteps, Class<?>... stepsClasses) {
    for (Class<?> stepsClass : stepsClasses) {
        boolean found = false;
        for (CandidateSteps steps : candidateSteps) {
            Object instance = ((Steps) steps).instance();
            if (instance.getClass() == stepsClass) {
                found = true;
            }
        }
        assertThat(found, is(true));
    }
}
Also used : Steps(org.jbehave.core.steps.Steps) CandidateSteps(org.jbehave.core.steps.CandidateSteps) UsingSteps(org.jbehave.core.annotations.UsingSteps) CandidateSteps(org.jbehave.core.steps.CandidateSteps)

Example 2 with Steps

use of org.jbehave.core.steps.Steps in project jbehave-core by jbehave.

the class NeedleStepsFactory method createCandidateSteps.

/**
 * {@inheritDoc}
 */
public List<CandidateSteps> createCandidateSteps() {
    final List<CandidateSteps> result = new ArrayList<>();
    for (final Class<?> type : steps) {
        if (hasAnnotatedMethods(type)) {
            configuration.parameterConverters().addConverters(methodReturningConverters(type));
            result.add(new Steps(configuration, type, this));
        }
    }
    return result;
}
Also used : Steps(org.jbehave.core.steps.Steps) CandidateSteps(org.jbehave.core.steps.CandidateSteps) ArrayList(java.util.ArrayList) CandidateSteps(org.jbehave.core.steps.CandidateSteps)

Example 3 with Steps

use of org.jbehave.core.steps.Steps in project jbehave-core by jbehave.

the class NeedleAnnotationBuilderBehaviour method assertThatStepsInstancesAre.

private void assertThatStepsInstancesAre(final List<CandidateSteps> candidateSteps, final Class<?>... stepsClasses) {
    assertThat(candidateSteps.size(), equalTo(stepsClasses.length));
    // transform candidateSteps to Set of classes
    final Set<Class<?>> candidateStepClasses = new HashSet<>();
    for (final CandidateSteps step : candidateSteps) {
        candidateStepClasses.add(((Steps) step).instance().getClass());
    }
    assertThat(candidateStepClasses, hasItems(stepsClasses));
}
Also used : Steps(org.jbehave.core.steps.Steps) CandidateSteps(org.jbehave.core.steps.CandidateSteps) UsingSteps(org.jbehave.core.annotations.UsingSteps) FooSteps(org.jbehave.core.steps.needle.NeedleStepsFactoryBehaviour.FooSteps) CandidateSteps(org.jbehave.core.steps.CandidateSteps) HashSet(java.util.HashSet)

Aggregations

CandidateSteps (org.jbehave.core.steps.CandidateSteps)3 Steps (org.jbehave.core.steps.Steps)3 UsingSteps (org.jbehave.core.annotations.UsingSteps)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 FooSteps (org.jbehave.core.steps.needle.NeedleStepsFactoryBehaviour.FooSteps)1