@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); }
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 { 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 { 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[]); }
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); }
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);  }