FileUtils { public static String read(final File file) throws IOException { final StringBuilder sb = new StringBuilder(); try ( final FileReader fr = new FileReader(file); final BufferedReader br = new BufferedReader(fr); ) { String sCurrentLine; while ((sCurrentLine = br.readLine()) != null) { sb.append(sCurrentLine); } } return sb.toString(); } private  FileUtils(); static void serialize(final File folder, final String content, final String fileName); static String read(final File file); static Long getSize(final File file); static void touch(final File folder , final String fileName); static String getFileChecksumSHA256(final File artifactFile);  }
@Test public void checkReadMethod() throws IOException { final URL testFile = Thread.currentThread().getContextClassLoader().getResource("org/axway/grapes/commons/utils/file.txt"); assertNotNull(testFile); assertEquals("Can you read this?", FileUtils.read(new File(testFile.getPath()))); }