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


Java Node类代码示例

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


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

示例1: processScenarioOutlineExamples

import gherkin.ast.Node; //导入依赖的package包/类
private void processScenarioOutlineExamples(
        final Map<Integer, AstNode> nodeMap, final ScenarioOutline scenarioOutline, final AstNode childNode
) {
    scenarioOutline.getExamples().forEach(examples -> {
        final AstNode examplesNode = new AstNode(examples, childNode);
        final TableRow headerRow = examples.getTableHeader();
        final AstNode headerNode = new AstNode(headerRow, examplesNode);
        nodeMap.put(headerRow.getLocation().getLine(), headerNode);
        IntStream.range(0, examples.getTableBody().size()).forEach(i -> {
            final TableRow examplesRow = examples.getTableBody().get(i);
            final Node rowNode = new CucumberSourceUtils.ExamplesRowWrapperNode(examplesRow, i);
            final AstNode expandedScenarioNode = new AstNode(rowNode, examplesNode);
            nodeMap.put(examplesRow.getLocation().getLine(), expandedScenarioNode);
        });
    });
}
 
开发者ID:allure-framework,项目名称:allure-java,代码行数:17,代码来源:CucumberSourceUtils.java

示例2: convertGherkinStepsToCucableSteps

import gherkin.ast.Node; //导入依赖的package包/类
/**
 * Converts a list of Gherkin steps to Cucable steps including data tables.
 *
 * @param gherkinSteps a {@link Step} list.
 * @return a {@link com.trivago.rta.vo.Step} list.
 */
List<com.trivago.rta.vo.Step> convertGherkinStepsToCucableSteps(final List<Step> gherkinSteps) {
    List<com.trivago.rta.vo.Step> steps = new ArrayList<>();

    for (Step gherkinStep : gherkinSteps) {
        com.trivago.rta.vo.Step step;
        com.trivago.rta.vo.DataTable dataTable = null;

        Node argument = gherkinStep.getArgument();
        if (argument instanceof DataTable) {
            dataTable = convertGherkinDataTableToCucumberDataTable((DataTable) argument);
        }

        String keywordAndName = gherkinStep.getKeyword().concat(gherkinStep.getText());
        step = new com.trivago.rta.vo.Step(keywordAndName, dataTable);
        steps.add(step);
    }
    return steps;
}
 
开发者ID:trivago,项目名称:cucable-plugin,代码行数:25,代码来源:GherkinToCucableConverter.java

示例3: processStep

import gherkin.ast.Node; //导入依赖的package包/类
private void processStep(Step step, List<StepDefinition> stepDefinitions)
{
    String keyword = step.getKeyword().trim();
    String text = step.getText().trim();
    Node argument = step.getArgument();

    testLog.logStep(keyword, text);

    for (StepDefinition stepDefinition : stepDefinitions)
    {
        if (stepDefinition.matches(text))
        {
            stepDefinition.invoke(text, argument);
            return;
        }
    }

    throw new StepDefinitionNotFoundException(keyword, text);
}
 
开发者ID:mauriciotogneri,项目名称:green-coffee,代码行数:20,代码来源:GreenCoffeeTest.java

示例4: createPickleArguments

import gherkin.ast.Node; //导入依赖的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

示例5: checkNodeSpelling

import gherkin.ast.Node; //导入依赖的package包/类
private void checkNodeSpelling(SensorContext sensorContext,
                               InputFile inputFile,
                               JLanguageTool langTool,
                               Node node,
                               String nodeText) throws IOException {
  List<RuleMatch> matches = langTool.check(nodeText);

  for (RuleMatch match : matches) {
    createSpellCheckIssueObject(sensorContext, inputFile, node, match);
  }
}
 
开发者ID:silverbulleters,项目名称:sonar-gherkin,代码行数:12,代码来源:GherkinSquidSensor.java

示例6: createPickleArguments

import gherkin.ast.Node; //导入依赖的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

示例7: ExamplesRowWrapperNode

import gherkin.ast.Node; //导入依赖的package包/类
ExamplesRowWrapperNode(final Node examplesRow, final int bodyRowIndex) {
    super(examplesRow.getLocation());
    this.bodyRowIndex = bodyRowIndex;
}
 
开发者ID:allure-framework,项目名称:allure-java,代码行数:5,代码来源:CucumberSourceUtils.java

示例8: AstNode

import gherkin.ast.Node; //导入依赖的package包/类
AstNode(final Node node, final AstNode parent) {
    this.node = node;
    this.parent = parent;
}
 
开发者ID:allure-framework,项目名称:allure-java,代码行数:5,代码来源:CucumberSourceUtils.java

示例9: getNode

import gherkin.ast.Node; //导入依赖的package包/类
public Node getNode() {
    return node;
}
 
开发者ID:allure-framework,项目名称:allure-java,代码行数:4,代码来源:CucumberSourceUtils.java

示例10: createSpellCheckIssueObject

import gherkin.ast.Node; //导入依赖的package包/类
private void createSpellCheckIssueObject(SensorContext sensorContext,
                                         InputFile inputFile,
                                         Node node,
                                         RuleMatch match) {

  // TODO: Don't hardcode the ruleKey
  RuleKey ruleKey = RuleKey.of(GherkinRulesDefinition.REPOSITORY_NAME, "SpellCheck");

  try {

    TextRange textRange = inputFile.newRange(
            node.getLocation().getLine(),
            match.getColumn(),
            node.getLocation().getLine(),
            match.getEndColumn()
    );

    NewIssue newIssue = sensorContext.newIssue();

    String suggestedReplace = "";

    if (!match.getSuggestedReplacements().isEmpty()) {
      suggestedReplace = " - replace it with:";
      for (String suggest: match.getSuggestedReplacements()
              ) {
        suggestedReplace = suggestedReplace + " " + suggest + ";";
      }
    }

    NewIssueLocation primaryLocation = newIssue.newLocation()
            .message(match.getMessage() + suggestedReplace)
            .on(inputFile)
            .at(textRange);

    newIssue.forRule(ruleKey).at(primaryLocation);
    newIssue.save();

  } catch (IllegalArgumentException iarg) {
    LOG.error("SpellCheck rule is an error when create issue: \n" +
            "file is: " + inputFile.relativePath() + "\n" +
            "match is:" + match.getMessage() + "\n" +
            "line is:" + node.getLocation().getLine() + "\n" +
            "offsets is: start - " + match.getColumn() + " to " + match.getEndColumn(),
            iarg);
  }

}
 
开发者ID:silverbulleters,项目名称:sonar-gherkin,代码行数:48,代码来源:GherkinSquidSensor.java


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