@Test
 public void test2() {
   SourceFile file =
       CxxAstScanner.scanSingleFile(new File("src/test/resources/checks/EmptyFile.cc"), check);
   CheckMessagesVerifier.verify(file.getCheckMessages())
       .next()
       .withMessage("Add a new line at the end of this file.")
       .noMore();
 }
  @Test
  public void fileWithoutTabs() throws UnsupportedEncodingException, IOException {
    check.createLineViolation = false;
    CxxFileTester tester =
        CxxFileTesterHelper.CreateCxxFileTester("src/test/resources/checks/NonEmptyFile.cc", ".");
    SourceFile file = CxxAstScanner.scanSingleFile(tester.cxxFile, tester.sensorContext, check);

    CheckMessagesVerifier.verify(file.getCheckMessages()).noMore();
  }
  @Test
  public void fileWithTabsOneMessagePerFile() throws UnsupportedEncodingException, IOException {
    check.createLineViolation = false;

    CxxFileTester tester =
        CxxFileTesterHelper.CreateCxxFileTester("src/test/resources/checks/TabCharacter.cc", ".");
    SourceFile file = CxxAstScanner.scanSingleFile(tester.cxxFile, tester.sensorContext, check);

    CheckMessagesVerifier.verify(file.getCheckMessages())
        .next()
        .withMessage("Replace all tab characters in this file by sequences of white-spaces.")
        .noMore();
  }
  @Test
  public void test() throws UnsupportedEncodingException, IOException {
    CommentRegularExpressionCheck check = new CommentRegularExpressionCheck();
    check.regularExpression = "(?i).*TODO.*";
    check.message = "Avoid TODO";

    CxxFileTester tester =
        CxxFileTesterHelper.CreateCxxFileTester(
            "src/test/resources/checks/commentRegularExpression.cc", ".");

    SourceFile file = CxxAstScanner.scanSingleFile(tester.cxxFile, tester.sensorContext, check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
        .next()
        .atLine(3)
        .withMessage("Avoid TODO")
        .next()
        .atLine(5)
        .next()
        .atLine(6)
        .noMore();
  }
  @Test
  public void detected() throws UnsupportedEncodingException, IOException {
    CxxFileTester tester =
        CxxFileTesterHelper.CreateCxxFileTester(
            "src/test/resources/checks/ReservedNamesCheck.cc", ".");
    SourceFile file =
        CxxAstScanner.scanSingleFile(
            tester.cxxFile, tester.sensorContext, new ReservedNamesCheck());

    checkMessagesVerifier
        .verify(file.getCheckMessages())
        .next()
        .atLine(3)
        .withMessage("Reserved name used for macro (keyword or alternative token redefined)")
        .next()
        .atLine(4)
        .next()
        .atLine(5)
        .next()
        .atLine(6)
        .next()
        .atLine(14)
        .withMessage(
            "Reserved name used for macro (begins with underscore followed by a capital letter)")
        .next()
        .atLine(15)
        .next()
        .atLine(16)
        .next()
        .atLine(18)
        .withMessage("Reserved name used for macro (contains two consecutive underscores)")
        .next()
        .atLine(19)
        .next()
        .atLine(20);
  }
 @Test
 public void test3() {
   SourceFile file =
       CxxAstScanner.scanSingleFile(new File("src/test/resources/checks/NonEmptyFile.cc"), check);
   CheckMessagesVerifier.verify(file.getCheckMessages()).noMore();
 }