当前位置: 首页>>代码示例>>Java>>正文


Java TableRow.getCells方法代码示例

本文整理汇总了Java中gherkin.ast.TableRow.getCells方法的典型用法代码示例。如果您正苦于以下问题:Java TableRow.getCells方法的具体用法?Java TableRow.getCells怎么用?Java TableRow.getCells使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gherkin.ast.TableRow的用法示例。


在下文中一共展示了TableRow.getCells方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convertGherkinExampleTableToCucableExampleMap

import gherkin.ast.TableRow; //导入方法依赖的package包/类
/**
 * Converts a Gherkin example table to a map of columns (keys) and rows (values)
 *
 * @param exampleTable a Gherkin {@link Examples} instance.
 * @return a map where the keys are the column headers and the values are lists of strings.
 */
Map<String, List<String>> convertGherkinExampleTableToCucableExampleMap(Examples exampleTable) {
    Map<String, List<String>> exampleMap = new LinkedHashMap<>();

    List<TableCell> headerCells = exampleTable.getTableHeader().getCells();
    for (TableCell headerCell : headerCells) {
        exampleMap.put("<" + headerCell.getValue() + ">", new ArrayList<>());
    }
    Object[] columnKeys = exampleMap.keySet().toArray();

    List<TableRow> tableBody = exampleTable.getTableBody();
    for (TableRow tableRow : tableBody) {
        List<TableCell> cells = tableRow.getCells();
        for (int i = 0; i < cells.size(); i++) {
            String columnKey = (String) columnKeys[i];
            List<String> values = exampleMap.get(columnKey);
            values.add(cells.get(i).getValue());
        }
    }
    return exampleMap;
}
 
开发者ID:trivago,项目名称:cucable-plugin,代码行数:27,代码来源:GherkinToCucableConverter.java

示例2: parametersMap

import gherkin.ast.TableRow; //导入方法依赖的package包/类
private Map<String, String> parametersMap(TableRow header, TableRow row)
{
    List<TableCell> headerCells = header.getCells();
    List<TableCell> rowCells = row.getCells();

    if (headerCells.size() == rowCells.size())
    {
        Map<String, String> parameters = new LinkedHashMap<>();

        for (int i = 0; i < headerCells.size(); i++)
        {
            TableCell headerCell = headerCells.get(i);
            TableCell rowCell = rowCells.get(i);

            parameters.put(headerCell.getValue(), rowCell.getValue());
        }

        return parameters;
    }
    else
    {
        throw new InvalidExampleException(header.getLocation().getLine(), header.getLocation().getColumn());
    }
}
 
开发者ID:mauriciotogneri,项目名称:green-coffee,代码行数:25,代码来源:GreenCoffeeConfig.java

示例3: createPickleArguments

import gherkin.ast.TableRow; //导入方法依赖的package包/类
private List<Argument> createPickleArguments(Node argument, List<TableCell> variableCells, List<TableCell> valueCells, String path) {
    List<Argument> result = new ArrayList<>();
    if (argument == null) return result;
    if (argument instanceof DataTable) {
        DataTable t = (DataTable) argument;
        List<TableRow> rows = t.getRows();
        List<PickleRow> newRows = new ArrayList<>(rows.size());
        for (TableRow row : rows) {
            List<TableCell> cells = row.getCells();
            List<PickleCell> newCells = new ArrayList<>();
            for (TableCell cell : cells) {
                newCells.add(
                        new PickleCell(
                                pickleLocation(cell.getLocation(), path),
                                interpolate(cell.getValue(), variableCells, valueCells)
                        )
                );
            }
            newRows.add(new PickleRow(newCells));
        }
        result.add(new PickleTable(newRows));
    } else if (argument instanceof DocString) {
        DocString ds = (DocString) argument;
        result.add(
                new PickleString(
                        pickleLocation(ds.getLocation(), path),
                        interpolate(ds.getContent(), variableCells, valueCells)
                )
        );
    } else {
        throw new RuntimeException("Unexpected argument type: " + argument);
    }
    return result;
}
 
开发者ID:andrewjc,项目名称:kheera-testrunner-android,代码行数:35,代码来源:Compiler.java

示例4: convertGherkinDataTableToCucumberDataTable

import gherkin.ast.TableRow; //导入方法依赖的package包/类
/**
 * Converts a Gherkin data table to a Cucable data table.
 *
 * @param gherkinDataTable a {@link DataTable}.
 * @return a {@link com.trivago.rta.vo.DataTable}.
 */
private com.trivago.rta.vo.DataTable convertGherkinDataTableToCucumberDataTable(final DataTable gherkinDataTable) {
    com.trivago.rta.vo.DataTable dataTable = new com.trivago.rta.vo.DataTable();
    for (TableRow row : gherkinDataTable.getRows()) {
        List<TableCell> cells = row.getCells();
        List<String> rowValues = new ArrayList<>();
        for (TableCell cell : cells) {
            rowValues.add(cell.getValue());
        }
        dataTable.addRow(rowValues);
    }
    return dataTable;
}
 
开发者ID:trivago,项目名称:cucable-plugin,代码行数:19,代码来源:GherkinToCucableConverter.java

示例5: createPickleArguments

import gherkin.ast.TableRow; //导入方法依赖的package包/类
private List<Argument> createPickleArguments(Node argument, List<TableCell> variableCells, List<TableCell> valueCells) {
    List<Argument> result = new ArrayList<>();
    if (argument == null) return result;
    if (argument instanceof DataTable) {
        DataTable t = (DataTable) argument;
        List<TableRow> rows = t.getRows();
        List<PickleRow> newRows = new ArrayList<>(rows.size());
        for (TableRow row : rows) {
            List<TableCell> cells = row.getCells();
            List<PickleCell> newCells = new ArrayList<>();
            for (TableCell cell : cells) {
                newCells.add(
                        new PickleCell(
                                pickleLocation(cell.getLocation()),
                                interpolate(cell.getValue(), variableCells, valueCells)
                        )
                );
            }
            newRows.add(new PickleRow(newCells));
        }
        result.add(new PickleTable(newRows));
    } else if (argument instanceof DocString) {
        DocString ds = (DocString) argument;
        result.add(
                new PickleString(
                        pickleLocation(ds.getLocation()),
                        interpolate(ds.getContent(), variableCells, valueCells)
                )
        );
    } else {
        throw new RuntimeException("Unexpected argument type: " + argument);
    }
    return result;
}
 
开发者ID:mauriciotogneri,项目名称:green-coffee,代码行数:35,代码来源:Compiler.java

示例6: compileScenarioOutline

import gherkin.ast.TableRow; //导入方法依赖的package包/类
private void compileScenarioOutline(List<Pickle> pickles, List<PickleStep> backgroundSteps, ScenarioOutline scenarioOutline, List<Tag> featureTags, String path) {
    if (scenarioOutline.getSteps().isEmpty())
      return;

    int exampleCount = 1;
    for (final Examples examples : scenarioOutline.getExamples()) {
        if (examples.getTableHeader() == null) continue;
        List<TableCell> variableCells = examples.getTableHeader().getCells();
        for (final TableRow values : examples.getTableBody()) {
            List<TableCell> valueCells = values.getCells();

            List<PickleStep> steps = new ArrayList<>();
            steps.addAll(backgroundSteps);

            List<Tag> tags = new ArrayList<>();
            tags.addAll(featureTags);
            tags.addAll(scenarioOutline.getTags());
            tags.addAll(examples.getTags());

            for (Step scenarioOutlineStep : scenarioOutline.getSteps()) {
                String stepText = interpolate(scenarioOutlineStep.getText(), variableCells, valueCells);

                // TODO: Use an Array of location in DataTable/DocString as well.
                // If the Gherkin AST classes supported
                // a list of locations, we could just reuse the same classes

                PickleStep pickleStep = new PickleStep(
                        stepText,
                        createPickleArguments(scenarioOutlineStep.getArgument(), variableCells, valueCells, path),
                        asList(
                                pickleLocation(values.getLocation(), path),
                                pickleStepLocation(scenarioOutlineStep, path)
                        ),
                        scenarioOutlineStep.getKeyword().trim()
                );
                steps.add(pickleStep);
            }

            Pickle pickle = new Pickle(
                    interpolate(scenarioOutline.getName(), variableCells, valueCells)+ " Example No." + exampleCount++,
                    steps,
                    pickleTags(tags, path),
                    asList(
                            pickleLocation(values.getLocation(), path),
                            pickleLocation(scenarioOutline.getLocation(), path)
                    )
            );

            pickles.add(pickle);
        }
    }
}
 
开发者ID:andrewjc,项目名称:kheera-testrunner-android,代码行数:53,代码来源:Compiler.java

示例7: compileScenarioOutline

import gherkin.ast.TableRow; //导入方法依赖的package包/类
private void compileScenarioOutline(List<Pickle> pickles, List<PickleStep> backgroundSteps, ScenarioOutline scenarioOutline, List<Tag> featureTags) {
    if (scenarioOutline.getSteps().isEmpty())
        return;

    for (final Examples examples : scenarioOutline.getExamples()) {
        if (examples.getTableHeader() == null) continue;
        List<TableCell> variableCells = examples.getTableHeader().getCells();
        for (final TableRow values : examples.getTableBody()) {
            List<TableCell> valueCells = values.getCells();

            List<PickleStep> steps = new ArrayList<>();
            steps.addAll(backgroundSteps);

            List<Tag> tags = new ArrayList<>();
            tags.addAll(featureTags);
            tags.addAll(scenarioOutline.getTags());
            tags.addAll(examples.getTags());

            for (Step scenarioOutlineStep : scenarioOutline.getSteps()) {
                String stepText = interpolate(scenarioOutlineStep.getText(), variableCells, valueCells);

                // TODO: Use an Array of location in DataTable/DocString as well.
                // If the Gherkin AST classes supported
                // a list of locations, we could just reuse the same classes

                PickleStep pickleStep = new PickleStep(
                        stepText,
                        createPickleArguments(scenarioOutlineStep.getArgument(), variableCells, valueCells),
                        asList(
                                pickleLocation(values.getLocation()),
                                pickleStepLocation(scenarioOutlineStep)
                        )
                );
                steps.add(pickleStep);
            }

            Pickle pickle = new Pickle(
                    interpolate(scenarioOutline.getName(), variableCells, valueCells),
                    steps,
                    pickleTags(tags),
                    asList(
                            pickleLocation(values.getLocation()),
                            pickleLocation(scenarioOutline.getLocation())
                    )
            );

            pickles.add(pickle);
        }
    }
}
 
开发者ID:mauriciotogneri,项目名称:green-coffee,代码行数:51,代码来源:Compiler.java

示例8: compileScenarioOutline

import gherkin.ast.TableRow; //导入方法依赖的package包/类
private void compileScenarioOutline(List<Pickle> pickles, List<PickleStep> backgroundSteps, ScenarioOutline scenarioOutline, List<Tag> featureTags, String language) {
    for (final Examples examples : scenarioOutline.getExamples()) {
        if (examples.getTableHeader() == null) continue;
        List<TableCell> variableCells = examples.getTableHeader().getCells();
        for (final TableRow values : examples.getTableBody()) {
            List<TableCell> valueCells = values.getCells();

            List<PickleStep> steps = new ArrayList<>();
            if (!scenarioOutline.getSteps().isEmpty())
                steps.addAll(backgroundSteps);

            List<Tag> tags = new ArrayList<>();
            tags.addAll(featureTags);
            tags.addAll(scenarioOutline.getTags());
            tags.addAll(examples.getTags());

            for (Step scenarioOutlineStep : scenarioOutline.getSteps()) {
                String stepText = interpolate(scenarioOutlineStep.getText(), variableCells, valueCells);

                // TODO: Use an Array of location in DataTable/DocString as well.
                // If the Gherkin AST classes supported
                // a list of locations, we could just reuse the same classes

                PickleStep pickleStep = new PickleStep(
                        stepText,
                        createPickleArguments(scenarioOutlineStep.getArgument(), variableCells, valueCells),
                        asList(
                                pickleLocation(values.getLocation()),
                                pickleStepLocation(scenarioOutlineStep)
                        )
                );
                steps.add(pickleStep);
            }

            Pickle pickle = new Pickle(
                    interpolate(scenarioOutline.getName(), variableCells, valueCells),
                    language,
                    steps,
                    pickleTags(tags),
                    asList(
                            pickleLocation(values.getLocation()),
                            pickleLocation(scenarioOutline.getLocation())
                    )
            );

            pickles.add(pickle);
        }
    }
}
 
开发者ID:cucumber,项目名称:gherkin-java,代码行数:50,代码来源:Compiler.java


注:本文中的gherkin.ast.TableRow.getCells方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。