CallChecker { static String createName(final ForLoopDeclarationRowDescriptor<?> descriptor) { final List<String> variables = descriptor.getCreatingVariables() .map(RobotToken::getText) .collect(toList()); final String in = descriptor.getInAction().getText().toUpperCase(); final List<RobotToken> args = descriptor.getRow().getArguments(); final String source = args.stream() .skip(variables.size() + 1) .map(RobotToken::getText) .collect(joining(" | ", "[ ", " ]")); return variables.stream().collect(joining(" | ")) + " " + in + " " + source; }    }
@Test public void forKeywordNamesGenerationTests_1() { final RobotExecutableRow<Object> row = new RobotExecutableRow<>(); row.setParent(new TestCase(RobotToken.create("test"))); row.setAction(RobotToken.create(":FOR", RobotTokenType.FOR_TOKEN)); row.addArgument(RobotToken.create("${x}")); row.addArgument(RobotToken.create("IN", RobotTokenType.IN_TOKEN)); row.addArgument(RobotToken.create("${XS}")); final IExecutableRowDescriptor<?> desc = row.buildLineDescription(); assertThat(CallChecker.createName((ForLoopDeclarationRowDescriptor<?>) desc)).isEqualTo("${x} IN [ ${XS} ]"); }
@Test public void forKeywordNamesGenerationTests_2() { final RobotExecutableRow<Object> row = new RobotExecutableRow<>(); row.setParent(new TestCase(RobotToken.create("test"))); row.setAction(RobotToken.create(":FOR", RobotTokenType.FOR_TOKEN)); row.addArgument(RobotToken.create("${x}")); row.addArgument(RobotToken.create("${y}")); row.addArgument(RobotToken.create("IN ZIP", RobotTokenType.IN_TOKEN)); row.addArgument(RobotToken.create("${XS}")); row.addArgument(RobotToken.create("${YS}")); final IExecutableRowDescriptor<?> desc = row.buildLineDescription(); assertThat(CallChecker.createName((ForLoopDeclarationRowDescriptor<?>) desc)) .isEqualTo("${x} | ${y} IN ZIP [ ${XS} | ${YS} ]"); }