Package org.jbehave.core.configuration

Examples of org.jbehave.core.configuration.MostUsefulConfiguration


    }

    @Test(expected=StartingWordNotFound.class)
    public void shouldNotCreateStepIfStartingWordNotFound(){
        Configuration configuration = new MostUsefulConfiguration();
        configuration.useKeywords(new LocalizedKeywords(new Locale("it")));
      LocalizedSteps steps = new LocalizedSteps(configuration);
        List<StepCandidate> candidates = steps.listCandidates();
        assertThat(candidates.size(), equalTo(3));

        // misspelled starting word
View Full Code Here


        return candidateWith(patternAsString, stepType, method, instance, new ParameterControls());
    }

    private StepCandidate candidateWith(String patternAsString, StepType stepType, Method method, Object instance, ParameterControls parameterControls) {
        Class<?> stepsType = instance.getClass();
        InjectableStepsFactory stepsFactory = new InstanceStepsFactory(new MostUsefulConfiguration(), instance);
        return new StepCandidate(patternAsString, 0, stepType, method, stepsType, stepsFactory, keywords,
                new RegexPrefixCapturingPatternParser(), new ParameterConverters(), parameterControls);
    }
View Full Code Here

        }
    }

    @Test
    public void shouldPerformStepsInDryRunMode() {
        Configuration configuration = new MostUsefulConfiguration();
        configuration.storyControls().doDryRun(true);
        NamedTypeSteps steps = new NamedTypeSteps(configuration);
        List<StepCandidate> candidates = steps.listCandidates();
        assertThat(candidates.size(), equalTo(2));
        StepCandidate step0 = candidateMatchingStep(candidates, "Given foo named $name");
        step0.createMatchedStep("Given foo named xyz", namedParameters).perform(null);
View Full Code Here

        String whenName;
        int givenTimes;
        int whenTimes;

        public NamedTypeSteps() {
            this(new MostUsefulConfiguration());
        }
View Full Code Here

public class InstanceStepsFactoryBehaviour {
   
    @Test
    public void shouldCreateCandidateSteps() {
        InjectableStepsFactory factory = new InstanceStepsFactory(new MostUsefulConfiguration(), new MySteps());
        List<CandidateSteps> candidateSteps = factory.createCandidateSteps();
        assertThat(candidateSteps.size(), equalTo(1));
        assertThat(candidateSteps.get(0), instanceOf(Steps.class));
        ParameterConverters converters = ((Steps)candidateSteps.get(0)).configuration().parameterConverters();
        assertThat((String)converters.convert("value", String.class), equalTo("valueConverted"));
View Full Code Here

        assertThat((String)converters.convert("value", String.class), equalTo("valueConverted"));
    }   

    @Test
    public void shouldDetermineIfStepsInstanceHasAnnotatedMethods() {
        InstanceStepsFactory factory = new InstanceStepsFactory(new MostUsefulConfiguration());
        assertThat(factory.hasAnnotatedMethods(MySteps.class), is(true));
        assertThat(factory.hasAnnotatedMethods(NoAnnotatedMethods.class), is(false));
    }
View Full Code Here

  public void shouldAllowGenericList() {
    List<? super MyInterface> list = new ArrayList<MyInterface>();
    list.add(new MyStepsAWithInterface());
    list.add(new MyStepsBWithInterface());
    InstanceStepsFactory factory = new InstanceStepsFactory(
            new MostUsefulConfiguration(), list);
    List<CandidateSteps> candidateSteps = factory.createCandidateSteps();   
    assertThat(candidateSteps.size(), equalTo(2));

  }
View Full Code Here

    @Test
    public void shouldHandleTargetInvocationFailureInBeforeOrAfterStep() throws IntrospectionException {
        // Given
        SomeSteps stepsInstance = new SomeSteps();
        MostUsefulConfiguration configuration = new MostUsefulConfiguration();
        InjectableStepsFactory stepsFactory = new InstanceStepsFactory(configuration, stepsInstance);
        StepCreator stepCreator = new StepCreator(stepsInstance.getClass(), stepsFactory,
                configuration.parameterConverters(), new ParameterControls(), null, new SilentStepMonitor());

        // When
        Method method = SomeSteps.methodFor("aFailingBeforeScenarioMethod");
        StepResult stepResult = stepCreator.createBeforeOrAfterStep(method, Meta.EMPTY).perform(null);
View Full Code Here

    @Test
    public void shouldDescribeStepToReporterBeforeExecutingParametrisedStep() throws IntrospectionException {
        // Given
        SomeSteps stepsInstance = new SomeSteps();
        InjectableStepsFactory stepsFactory = new InstanceStepsFactory(new MostUsefulConfiguration(), stepsInstance);
        StepCreator stepCreator = new StepCreator(stepsInstance.getClass(), stepsFactory, null,
                new ParameterControls(), null, new SilentStepMonitor());
        StoryReporter storyReporter = mock(StoryReporter.class);

        // When
View Full Code Here

    @Test
    public void shouldHandleTargetInvocationFailureInParametrisedStep() throws IntrospectionException {
        // Given
        SomeSteps stepsInstance = new SomeSteps();
        InjectableStepsFactory stepsFactory = new InstanceStepsFactory(new MostUsefulConfiguration(), stepsInstance);
        StepCreator stepCreator = new StepCreator(stepsInstance.getClass(), stepsFactory, null,
                new ParameterControls(), null, new SilentStepMonitor());

        // When
        Method method = SomeSteps.methodFor("aFailingMethod");
View Full Code Here

TOP

Related Classes of org.jbehave.core.configuration.MostUsefulConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.