use of io.cucumber.core.gherkin.Step in project cucumber-jvm by cucumber.
the class FeatureParserTest method backgrounds_can_occur_twice.
@Test
void backgrounds_can_occur_twice() throws IOException {
URI uri = URI.create("classpath:com/example.feature");
String source = new String(readAllBytes(Paths.get("src/test/resources/io/cucumber/core/gherkin/messages/background.feature")));
Feature feature = parser.parse(uri, source, UUID::randomUUID).get();
Pickle pickle = feature.getPickles().get(0);
List<Step> steps = pickle.getSteps();
assertEquals(3, steps.size());
}
use of io.cucumber.core.gherkin.Step in project cucumber-jvm by cucumber.
the class FeatureParserTest method empty_table_is_parsed.
@Test
void empty_table_is_parsed() throws IOException {
URI uri = URI.create("classpath:com/example.feature");
String source = new String(readAllBytes(Paths.get("src/test/resources/io/cucumber/core/gherkin/messages/empty-table.feature")));
Feature feature = parser.parse(uri, source, UUID::randomUUID).get();
Pickle pickle = feature.getPickles().get(0);
Step step = pickle.getSteps().get(0);
DataTableArgument argument = (DataTableArgument) step.getArgument();
assertEquals(5, argument.getLine());
}
use of io.cucumber.core.gherkin.Step in project cucumber-jvm by cucumber.
the class FeatureParserTest method empty_doc_string_media_type_is_null.
@Test
void empty_doc_string_media_type_is_null() throws IOException {
URI uri = URI.create("classpath:com/example.feature");
String source = new String(readAllBytes(Paths.get("src/test/resources/io/cucumber/core/gherkin/messages/doc-string.feature")));
Feature feature = parser.parse(uri, source, UUID::randomUUID).get();
Pickle pickle = feature.getPickles().get(0);
List<Step> steps = pickle.getSteps();
assertAll(() -> {
assertNull(((DocStringArgument) steps.get(0).getArgument()).getContentType());
assertEquals("text/plain", ((DocStringArgument) steps.get(1).getArgument()).getContentType());
});
}
use of io.cucumber.core.gherkin.Step in project cucumber-jvm by cucumber.
the class JavaSnippetTest method snippetForDataTable.
private String snippetForDataTable(String stepText) {
Step step = createStepWithDataTable(stepText);
List<String> snippet = new SnippetGenerator(new JavaSnippet(), new ParameterTypeRegistry(Locale.ENGLISH)).getSnippet(step, snippetType);
return String.join("\n", snippet);
}
use of io.cucumber.core.gherkin.Step in project cucumber-jvm by cucumber.
the class JavaSnippetTest method snippetForWhenAnd.
private String snippetForWhenAnd(String stepText) {
String source = "" + "Feature: Test feature\n" + " Scenario: Test Scenario\n" + " When some other step\n" + " And " + stepText + "\n";
Feature feature = TestFeatureParser.parse(source);
Step step = feature.getPickles().get(0).getSteps().get(1);
List<String> snippet = new SnippetGenerator(new JavaSnippet(), new ParameterTypeRegistry(Locale.ENGLISH)).getSnippet(step, snippetType);
return String.join("\n", snippet);
}
Aggregations