Search in sources :

Example 1 with Location

use of gherkin.ast.Location in project cucable-plugin by trivago.

the class GherkinToCucableConverterTest method convertGherkinExampleTableToCucableExampleMapTest.

@Test
public void convertGherkinExampleTableToCucableExampleMapTest() {
    Location location = new Location(1, 2);
    List<Tag> tags = new ArrayList<>();
    Tag tag = new Tag(location, "@tag");
    tags.add(tag);
    String keyword = "keyword";
    String name = "name";
    String description = "description";
    List<TableCell> headerCells = new ArrayList<>();
    headerCells.add(new TableCell(location, "headerCell1"));
    headerCells.add(new TableCell(location, "headerCell2"));
    headerCells.add(new TableCell(location, "headerCell3"));
    TableRow tableHeader = new TableRow(location, headerCells);
    List<TableRow> tableBody = new ArrayList<>();
    List<TableCell> bodyCells = new ArrayList<>();
    bodyCells.add(new TableCell(location, "bodyCell1"));
    bodyCells.add(new TableCell(location, "bodyCell2"));
    bodyCells.add(new TableCell(location, "bodyCell3"));
    tableBody.add(new TableRow(location, bodyCells));
    bodyCells = new ArrayList<>();
    bodyCells.add(new TableCell(location, "bodyCell4"));
    bodyCells.add(new TableCell(location, "bodyCell5"));
    bodyCells.add(new TableCell(location, "bodyCell6"));
    tableBody.add(new TableRow(location, bodyCells));
    Examples examples = new Examples(location, tags, keyword, name, description, tableHeader, tableBody);
    List<String> includeTags = new ArrayList<>();
    List<String> excludeTags = new ArrayList<>();
    Map<String, List<String>> table = gherkinToCucableConverter.convertGherkinExampleTableToCucableExampleMap(examples);
    assertThat(table.size(), is(3));
}
Also used : ArrayList(java.util.ArrayList) TableCell(gherkin.ast.TableCell) TableRow(gherkin.ast.TableRow) ArrayList(java.util.ArrayList) List(java.util.List) Tag(gherkin.ast.Tag) Examples(gherkin.ast.Examples) Location(gherkin.ast.Location) Test(org.junit.Test)

Example 2 with Location

use of gherkin.ast.Location in project cucable-plugin by trivago.

the class GherkinToCucableConverterTest method convertGherkinStepsToCucableStepsTest.

@Test
public void convertGherkinStepsToCucableStepsTest() {
    List<Step> gherkinSteps = Arrays.asList(new Step(new Location(1, 1), "Given ", "this is a test step", null), new Step(new Location(2, 1), "Then ", "I get a test result", null));
    List<com.trivago.vo.Step> steps = gherkinToCucableConverter.convertGherkinStepsToCucableSteps(gherkinSteps);
    assertThat(steps.size(), is(gherkinSteps.size()));
    com.trivago.vo.Step firstStep = steps.get(0);
    assertThat(firstStep.getName(), is("Given this is a test step"));
    com.trivago.vo.Step secondStep = steps.get(1);
    assertThat(secondStep.getName(), is("Then I get a test result"));
}
Also used : Step(gherkin.ast.Step) Location(gherkin.ast.Location) Test(org.junit.Test)

Example 3 with Location

use of gherkin.ast.Location in project cucable-plugin by trivago.

the class GherkinToCucableConverterTest method convertGherkinStepsToCucableStepsTest.

@Test
public void convertGherkinStepsToCucableStepsTest() {
    List<Step> gherkinSteps = Arrays.asList(new Step(new Location(1, 1), "Given ", "this is a test step", null), new Step(new Location(2, 1), "Then ", "I get a test result", null));
    List<com.trivago.rta.vo.Step> steps = gherkinToCucableConverter.convertGherkinStepsToCucableSteps(gherkinSteps);
    assertThat(steps.size(), is(gherkinSteps.size()));
    com.trivago.rta.vo.Step firstStep = steps.get(0);
    assertThat(firstStep.getName(), is("Given this is a test step"));
    com.trivago.rta.vo.Step secondStep = steps.get(1);
    assertThat(secondStep.getName(), is("Then I get a test result"));
}
Also used : Step(gherkin.ast.Step) Location(gherkin.ast.Location) Test(org.junit.Test)

Aggregations

Location (gherkin.ast.Location)3 Test (org.junit.Test)3 Step (gherkin.ast.Step)2 Examples (gherkin.ast.Examples)1 TableCell (gherkin.ast.TableCell)1 TableRow (gherkin.ast.TableRow)1 Tag (gherkin.ast.Tag)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1