@Test
  public void test_emptyFile_createTestSetup_andKeyword_andComments() throws Exception {
    // prepare
    final String fileName =
        PRETTY_NEW_DIR_LOCATION + "TestSetupDeclarationWithKeywordCommentsOnly." + getExtension();
    final RobotFile modelFile = NewRobotFileTestHelper.getModelFileToModify("2.9");

    // test data prepare
    modelFile.includeSettingTableSection();
    final SettingTable settingTable = modelFile.getSettingTable();
    final TestSetup testSetup = settingTable.newTestSetup();

    RobotToken keyword = new RobotToken();
    keyword.setText("keyword");

    testSetup.setKeywordName(keyword);

    RobotToken cm1 = new RobotToken();
    cm1.setText("cm1");
    RobotToken cm2 = new RobotToken();
    cm2.setText("cm2");
    RobotToken cm3 = new RobotToken();
    cm3.setText("cm3");
    testSetup.addCommentPart(cm1);
    testSetup.addCommentPart(cm2);
    testSetup.addCommentPart(cm3);

    // verify
    NewRobotFileTestHelper.assertNewModelTheSameAsInFile(fileName, modelFile);
  }
 @Override
 public void map(
     final RobotLine currentLine,
     final RobotToken rt,
     final ParsingState currentState,
     final RobotFile fileModel) {
   List<SuiteDocumentation> documentations = fileModel.getSettingTable().getDocumentation();
   if (!documentations.isEmpty()) {
     SuiteDocumentation suiteDoc = documentations.get(documentations.size() - 1);
     suiteDoc.addCommentPart(rt);
   } else {
     // FIXME: errors
   }
 }
 @Override
 public void map(
     final RobotLine currentLine,
     final RobotToken rt,
     final ParsingState currentState,
     final RobotFile fileModel) {
   List<TestTemplate> testTemplates = fileModel.getSettingTable().getTestTemplates();
   if (!testTemplates.isEmpty()) {
     TestTemplate testTemplate = testTemplates.get(testTemplates.size() - 1);
     testTemplate.addCommentPart(rt);
   } else {
     // FIXME: errors internal
   }
 }
  @Test
  public void test_emptyFile_and_thanCreateTestSetup() throws Exception {
    // prepare
    final String fileName =
        PRETTY_NEW_DIR_LOCATION + "EmptyTestSetupDeclarationOnly." + getExtension();
    final RobotFile modelFile = NewRobotFileTestHelper.getModelFileToModify("2.9");

    // test data prepare
    modelFile.includeSettingTableSection();
    final SettingTable settingTable = modelFile.getSettingTable();
    settingTable.newTestSetup();

    // verify
    NewRobotFileTestHelper.assertNewModelTheSameAsInFile(fileName, modelFile);
  }
Exemplo n.º 5
0
 private void assertThatTestCaseTableIsIncluded(final RobotFile fileModel) {
   assertThat(fileModel.getSettingTable().isPresent()).isFalse();
   assertThat(fileModel.getVariableTable().isPresent()).isFalse();
   assertThat(fileModel.getTestCaseTable().isPresent()).isTrue();
   assertThat(fileModel.getKeywordTable().isPresent()).isFalse();
 }