use of gherkin.formatter.model.Step in project cucumber-jvm by cucumber.
the class JavaStepDefinitionTest method throws_ambiguous_when_two_matches_are_found.
@Test
public void throws_ambiguous_when_two_matches_are_found() throws Throwable {
backend.addStepDefinition(THREE_DISABLED_MICE.getAnnotation(Given.class), THREE_DISABLED_MICE);
backend.addStepDefinition(THREE_BLIND_ANIMALS.getAnnotation(Given.class), THREE_BLIND_ANIMALS);
Reporter reporter = mock(Reporter.class);
runtime.buildBackendWorlds(reporter, Collections.<Tag>emptySet(), mock(Scenario.class));
Tag tag = new Tag("@foo", 0);
runtime.runBeforeHooks(reporter, asSet(tag));
runtime.runStep("some.feature", new Step(NO_COMMENTS, "Given ", "three blind mice", 1, null, null), reporter, ENGLISH);
ArgumentCaptor<Result> result = ArgumentCaptor.forClass(Result.class);
verify(reporter).result(result.capture());
assertEquals(AmbiguousStepDefinitionsException.class, result.getValue().getError().getClass());
}
use of gherkin.formatter.model.Step in project cucumber-jvm by cucumber.
the class FromDataTableTest method runStepDef.
private StepDefs runStepDef(Method method, List<DataTableRow> rows) throws Throwable {
StepDefs stepDefs = new StepDefs();
StepDefinition stepDefinition = new StubStepDefinition(stepDefs, method, "some pattern");
Step stepWithRows = new Step(NO_COMMENTS, "Given ", "something", 10, rows, null);
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
StepDefinitionMatch stepDefinitionMatch = new StepDefinitionMatch(NO_ARGS, stepDefinition, "some.feature", stepWithRows, new LocalizedXStreams(classLoader));
stepDefinitionMatch.runStep(new I18n("en"));
return stepDefs;
}
use of gherkin.formatter.model.Step in project cucumber-jvm by cucumber.
the class CucumberScenarioOutlineTest method does_not_allow_the_step_to_be_empty_after_replacement.
@Test(expected = CucumberException.class)
public void does_not_allow_the_step_to_be_empty_after_replacement() {
Step outlineStep = new Step(C, null, "<step>", 0, null, null);
CucumberScenarioOutline.createExampleStep(outlineStep, new ExamplesTableRow(C, asList("step"), 1, ""), new ExamplesTableRow(C, asList(""), 1, ""));
}
use of gherkin.formatter.model.Step in project cucumber-jvm by cucumber.
the class JUnitFormatterTest method step.
private Step step(String keyword, String stepName) {
Step step = mock(Step.class);
when(step.getKeyword()).thenReturn(keyword);
when(step.getName()).thenReturn(stepName);
return step;
}
use of gherkin.formatter.model.Step in project cucumber-jvm by cucumber.
the class UndefinedStepsTrackerTest method has_undefined_steps.
@Test
public void has_undefined_steps() {
UndefinedStepsTracker undefinedStepsTracker = new UndefinedStepsTracker();
undefinedStepsTracker.addUndefinedStep(new Step(null, "Given ", "A", 1, null, null), ENGLISH);
assertTrue(undefinedStepsTracker.hasUndefinedSteps());
}
Aggregations