### Question:
BannedRefChecker { public void check(Report report, File file) { FileReader reader = null; BufferedReader buf = null; report.fileStart(file); try { reader = new FileReader(file); buf = new BufferedReader(reader); int linenum = 0; String line; while ((line = buf.readLine()) != null) { linenum++; testLine(report, linenum, line); } } catch (IOException e) { report.exception(e); } finally { IOUtil.close(buf); IOUtil.close(reader); report.fileEnd(); } } BannedRefChecker(String included[], String excluded[]); void check(Report report, File file);  }### Answer:
@Test public void testBannedRefsSimple() { File testSrcDir = MavenTestingUtils.getProjectDir("src/test/java"); String path = BannedRefCheckerTest.class.getName().replace('.', '/') + ".java"; File srcFile = PathAssert.assertFileExists(testSrcDir, path); String examples[] = { "Baseball", "Home Base", "Base Alpha", "BaseCall", "IBasedOn", "X-BASE-HEADER", "Base" }; String includes[] = { "base" }; String excludes[] = null; BannedRefChecker checker = new BannedRefChecker(includes, excludes); JunitReport report = new JunitReport(); checker.check(report, srcFile); Errors errors = report.assertContainsFile(srcFile); errors.assertCount(examples.length + includes.length); }
@Test public void testBannedRefsWithExclude() { File testSrcDir = MavenTestingUtils.getProjectDir("src/test/java"); String path = BannedRefCheckerTest.class.getName().replace('.', '/') + ".java"; File srcFile = PathAssert.assertFileExists(testSrcDir, path); String includes[] = { "man" }; String excludes[] = { "man inc", "manopensource", "com.man.kernel" }; BannedRefChecker checker = new BannedRefChecker(includes, excludes); JunitReport report = new JunitReport(); checker.check(report, srcFile); Errors errors = report.assertContainsFile(srcFile); errors.assertCount(13); }