### Question:
FileUtils { public static String resourceToString(String resourceName) { byte[] bytes = resourceToBytes(resourceName); return bytes == null ? null : new String(bytes); }  static void setFileProperties(); static File getParentFile(File f); static boolean mkdirsMaybe(File f); static boolean deleteFileMaybe(File f); static File[] listFiles(File f); static File[] listFiles(File f, FileFilter ff); static File[] listFiles(File f, FilenameFilter fnf); static boolean safeIsDirectory(File f); static boolean safeIsRealDirectory(String s); static boolean safeIsRealDirectory(File f); static boolean safeIsDirectory(String s); static String safeGetCanonicalPath(File f); static File safeGetCanonicalFile(File f); static boolean hasExtension(String filename, String ext); static boolean hasExtension(File f, String ext); static boolean hasExtensionIgnoreCase(String filename, String ext); static boolean hasExtensionIgnoreCase(File f, String ext); static boolean isLegalFilename(String filename); static boolean isFriendlyFilename(String filename); static String makeLegalFilename(String filename); static String makeLegalNoBlankFileName(String filename); static String makeFriendlyFilename(String filename); static String makeFriendlyFilenameNoExtension(String filename); static String makeFriendlyFilenameExtension(String filename); static String revertFriendlyFilenameExtension(String filename); static String revertFriendlyFilename(String filename); static void liquidate(File parent); static boolean isJar(String filename); static boolean isZip(String filename); static boolean isJar(File f); static boolean isZip(File f); static boolean whack(File parent); static boolean whack(File parent, Collection<File> undeletedFiles); static void deleteFileNowOrLater(File f); static void deleteOnExit(File f); static boolean deleteFileWithWaitLoop(File f); static boolean deleteFile(File f); static FileOutputStream openFileOutputStream(File out); static Set<File> getAllFilesUnder(File directory, FilenameFilter filenameFilter); static Set<File> getAllFilesUnder(File directory, FilenameFilter filenameFilter, boolean relativize); static Set<File> getAllFilesAndDirectoriesUnder(File directory); static File relativize(File parent, File child); static String formatFileCollection(Collection<File> files); static File getDirectory(File f); static File createTempFile(File directory); static File[] listAllFiles(File dirName, String ext); static List<File> searchDir(File dirName, String ext); static void copy(String from, String to); static void copy(File fin, File fout); static void copyTree(File din, File dout); static String makeForwardSlashes(String inputStr); static String quoteString(String s); static String getIllegalFilenameCharacters(); static void copyFile(File fin, File fout); static void copy(InputStream in, FileOutputStream out, long size); static void copyWithoutClose(InputStream in, FileOutputStream out, long size); static void copy(InputStream in, OutputStream os, long size); static boolean renameFile(File fromFile, File toFile); static void appendText(String fileName, String line); static void appendText(String fileName, StringBuilder buffer); static String readSmallFile(final String fileName); static String readSmallFile(final File file); static File getManagedFile(String file, File dir); static void writeStringToFile(String s, File f); static File[] findFilesInDir(File dir, final String regexp); static String resourceToString(String resourceName); static byte[] resourceToBytes(String resourceName);  }### Answer:
@Test public void testResourceToString() { String resname = "simplestring.txt"; String contents = "Simple String Here!"; String fetched = FileUtils.resourceToString(resname); assertEquals(contents, fetched); }
@Test public void testEmptyButExistingResourceToString() { String resname = "empty.txt"; String fetched = FileUtils.resourceToString(resname); assertNotNull(fetched); assertTrue(fetched.length() == 0); }
@Test public void testNonExistingResourceToString() { String resname = "doesnotexist.txt"; String fetched = FileUtils.resourceToString(resname); assertNull(fetched); }