• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Node类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FastClass类代码示例发布时间:2022-05-23
下一篇:
Java JavaClass类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap