SharedFileResource extends BaleenResource { public static String readFile(File file) throws IOException { String contents = FileUtils.file2String(file); contents = contents.replaceAll("\r\n", "\n"); return StringUtils.strip(contents); }  static String readFile(File file); static String[] readFileLines(File file);  }
@Test public void testReadFile() throws Exception { assertEquals( "This is my test file.\n\t\nIt has lots of whitespace in it!", SharedFileResource.readFile(new File(getClass().getResource("test.txt").toURI()))); try { SharedFileResource.readFile(new File("missing.txt")); fail("Expected an exception"); } catch (IOException ioe) { } }