@Test
 public void test_non_empty_file() {
   SourceFile file =
       JavaAstScanner.scanSingleFile(
           new File("src/test/files/checks/NonEmptyFile.java"), new VisitorsBridge(check));
   CheckMessagesVerifier.verify(file.getCheckMessages()).noMore();
 }
 @Test
 public void detected() {
   SourceFile file =
       JavaAstScanner.scanSingleFile(
           new File("src/test/files/checks/ReturnEmptyArrayyNotNullCheck.java"),
           new ReturnEmptyArrayyNotNullCheck());
   checkMessagesVerifier
       .verify(file.getCheckMessages())
       .next()
       .atLine(16)
       .withMessage("Return an empty array instead of null.")
       .next()
       .atLine(25)
       .next()
       .atLine(35)
       .next()
       .atLine(40)
       .next()
       .atLine(44)
       .next()
       .atLine(48)
       .next()
       .atLine(53)
       .withMessage("Return an empty collection instead of null.")
       .next()
       .atLine(57)
       .withMessage("Return an empty array instead of null.")
       .next()
       .atLine(61);
 }
 @Test
 public void check_with_exclusion() {
   check.exclude = "com.sun.imageio,com.sun.jersey";
   SourceFile file =
       JavaAstScanner.scanSingleFile(
           new File("src/test/files/checks/SunPackagesUsedCheck.java"), check);
   checkMessagesVerifier
       .verify(file.getCheckMessages())
       .next()
       .atLine(10)
       .withMessage("Replace this usage of Sun classes by ones from the Java API.");
 }
 @Test
 public void detected() {
   SourceFile file =
       JavaAstScanner.scanSingleFile(
           new File("src/test/files/checks/RightCurlyBraceDifferentLineAsNextBlockCheck.java"),
           new RightCurlyBraceDifferentLineAsNextBlockCheck());
   checkMessagesVerifier
       .verify(file.getCheckMessages())
       .next()
       .atLine(5)
       .withMessage("Move this \"else\" keyword to a new dedicated line.")
       .next()
       .atLine(14)
       .withMessage("Move this \"catch\" keyword to a new dedicated line.");
 }
 @Test
 public void detected() {
   SourceFile file =
       JavaAstScanner.scanSingleFile(
           new File("src/test/files/checks/StringLiteralInsideEqualsCheck.java"),
           new StringLiteralInsideEqualsCheck());
   checkMessagesVerifier
       .verify(file.getCheckMessages())
       .next()
       .atLine(3)
       .withMessage("Move the \"bar\" string literal on the left side of this string comparison.")
       .next()
       .atLine(4)
       .withMessage("Move the \"qux\" string literal on the left side of this string comparison.")
       .next()
       .atLine(11)
       .withMessage("Move the \"\" string literal on the left side of this string comparison.");
 }
 @Test
 public void detected() {
   SourceFile file =
       JavaAstScanner.scanSingleFile(
           new File("src/test/files/checks/UtilityClassWithPublicConstructorCheck.java"),
           new UtilityClassWithPublicConstructorCheck());
   checkMessagesVerifier
       .verify(file.getCheckMessages())
       .next()
       .atLine(9)
       .withMessage("Add a private constructor to hide the implicit public one.")
       .next()
       .atLine(23)
       .withMessage("Hide this public constructor.")
       .next()
       .atLine(44)
       .next()
       .atLine(68);
 }
 @Test
 public void detected() {
   SourceFile file =
       JavaAstScanner.scanSingleFile(
           new File("src/test/files/checks/SunPackagesUsedCheck.java"), check);
   checkMessagesVerifier
       .verify(file.getCheckMessages())
       .next()
       .atLine(1)
       .withMessage("Replace this usage of Sun classes by ones from the Java API.")
       .next()
       .atLine(2)
       .next()
       .atLine(7)
       .next()
       .atLine(8)
       .next()
       .atLine(10);
 }