Ejemplo n.º 1
0
  @Test
  public void test_emptyFile_and_thanCreateScalarVariable_andOneValue_andComment()
      throws Exception {
    // prepare
    final String fileName =
        PRETTY_NEW_DIR_LOCATION
            + "ScalarVariableDeclarationAndOneValueAndCommentOnly."
            + getExtension();
    final RobotFile modelFile = NewRobotFileTestHelper.getModelFileToModify("2.9");

    // test data prepare
    modelFile.includeVariableTableSection();
    final VariableTable variableTable = modelFile.getVariableTable();
    final List<String> values = new ArrayList<>();
    values.add("value1");

    final AVariable aVariable = variableTable.createScalarVariable(0, "scalar", values);
    final RobotToken cmTok1 = new RobotToken();
    cmTok1.setText("cm1");
    final RobotToken cmTok2 = new RobotToken();
    cmTok2.setText("cm2");
    final RobotToken cmTok3 = new RobotToken();
    cmTok3.setText("cm3");

    aVariable.addCommentPart(cmTok1);
    aVariable.addCommentPart(cmTok2);
    aVariable.addCommentPart(cmTok3);

    // verify
    NewRobotFileTestHelper.assertNewModelTheSameAsInFile(fileName, modelFile);
  }