diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-02-14 12:48:07 +0200 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-02-14 12:48:07 +0200 |
commit | 0628eea037ebb9f47ad77f37c59145082fc2e74c (patch) | |
tree | b9ed441c79ba1e4acad13aa70ffdb4379cac5ea9 /tests/server-side | |
parent | ecd80181d160b58a281eb92fabaa2a10ea0adac2 (diff) | |
parent | 36f749b4f83086a5306726ad607c9bb3a0fa7526 (diff) | |
download | vaadin-framework-0628eea037ebb9f47ad77f37c59145082fc2e74c.tar.gz vaadin-framework-0628eea037ebb9f47ad77f37c59145082fc2e74c.zip |
Merge remote branch 'origin/6.8'
Conflicts:
WebContent/release-notes.html
tests/test.xml
tests/testbench/com/vaadin/tests/components/datefield/DateFieldPopupOffScreen.java
Diffstat (limited to 'tests/server-side')
-rw-r--r-- | tests/server-side/com/vaadin/tests/server/SourceFileChecker.java | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/tests/server-side/com/vaadin/tests/server/SourceFileChecker.java b/tests/server-side/com/vaadin/tests/server/SourceFileChecker.java index 3115ce49c8..453aab5af8 100644 --- a/tests/server-side/com/vaadin/tests/server/SourceFileChecker.java +++ b/tests/server-side/com/vaadin/tests/server/SourceFileChecker.java @@ -134,20 +134,37 @@ public class SourceFileChecker extends TestCase { } } - class DosNewlineDetector implements FileValidator { - + abstract class FileContentsValidator implements FileValidator { public void validateFile(File f) throws Exception { - String contents = IOUtils.toString(new FileInputStream(f)); + FileInputStream fis = new FileInputStream(f); + String contents = IOUtils.toString(fis); + fis.close(); + validateContents(f, contents); + } + + protected abstract void validateContents(File f, String contents) + throws Exception; + + } + + class DosNewlineDetector extends FileContentsValidator { + + @Override + protected void validateContents(File f, String contents) + throws Exception { if (contents.contains("\r\n")) { throw new IllegalArgumentException(); } } + } - class LicenseChecker implements FileValidator { - public void validateFile(File f) throws Exception { - String contents = IOUtils.toString(new FileInputStream(f)); + class LicenseChecker extends FileContentsValidator { + + @Override + protected void validateContents(File f, String contents) + throws Exception { if (!contents.contains("@" + "VaadinApache2LicenseForJavaFiles" + "@")) { throw new IllegalArgumentException(); |