FileUtils { public static void assertExists(File... files) throws FileNotFoundException { for (File file : files) { if (!file.exists()) { throw new FileNotFoundException(file.getAbsolutePath()); } } } private  FileUtils(); static void createDir(File target); static void createDirs(File target); static File[] listFilesSorted(File directory); static PrintWriter openPrintWriterToFile(File file, boolean verbose); static void assertExists(File... files);  }
@Test public void testAssertExistsOneFile() throws Exception { File f = tempFolder.newFile(); FileUtils.assertExists(f); }
@Test public void testAssertExistsTwoFiles() throws Exception { File f1 = tempFolder.newFile(); File f2 = tempFolder.newFile(); FileUtils.assertExists(f1, f2); }
@Test(expected = FileNotFoundException.class) public void testAssertExistsThrowsExceptionForNonExistentFile() throws Exception { File f = tempFolder.newFile(); f.delete(); FileUtils.assertExists(f); }
@Test(expected = FileNotFoundException.class) public void testAssertExistsThrowsExceptionOnNonExistentSecondFile() throws Exception { File f1 = tempFolder.newFile(); File f2 = tempFolder.newFile(); f2.delete(); FileUtils.assertExists(f1, f2); }