### Question:
FileOperations { @Nonnull public static FileIOError deleteFile (@Nonnull final File aFile) { ValueEnforcer.notNull (aFile, "File"); if (!FileHelper.existsFile (aFile)) return EFileIOErrorCode.SOURCE_DOES_NOT_EXIST.getAsIOError (EFileIOOperation.DELETE_FILE, aFile); final File aParentDir = aFile.getParentFile (); if (aParentDir != null && !aParentDir.canWrite ()) return EFileIOErrorCode.SOURCE_PARENT_NOT_WRITABLE.getAsIOError (EFileIOOperation.DELETE_FILE, aFile); try { Files.delete (aFile.toPath ()); return EFileIOErrorCode.NO_ERROR.getAsIOError (EFileIOOperation.DELETE_FILE, aFile); } catch (final NoSuchFileException ex) { return EFileIOErrorCode.SOURCE_DOES_NOT_EXIST.getAsIOError (EFileIOOperation.DELETE_FILE, aFile); } catch (final DirectoryNotEmptyException ex) { return EFileIOErrorCode.OPERATION_FAILED.getAsIOError (EFileIOOperation.DELETE_FILE, aFile); } catch (final IOException ex) { return EFileIOErrorCode.IO_ERROR.getAsIOError (EFileIOOperation.DELETE_FILE, aFile); } catch (final SecurityException ex) { return EFileIOErrorCode.getSecurityAsIOError (EFileIOOperation.DELETE_FILE, ex); } } private  FileOperations(); static boolean isExceptionOnDeleteRoot(); static void setExceptionOnDeleteRoot(final boolean bExceptionOnDeleteRoot); @Nonnull static FileIOError createDir(@Nonnull final File aDir); @Nonnull static FileIOError createDirIfNotExisting(@Nonnull final File aDir); @Nonnull static FileIOError createDirRecursive(@Nonnull final File aDir); @Nonnull static FileIOError createDirRecursiveIfNotExisting(@Nonnull final File aDir); @Nonnull static FileIOError deleteDir(@Nonnull final File aDir); @Nonnull static FileIOError deleteDirIfExisting(@Nonnull final File aDir); @Nonnull static FileIOError deleteDirRecursive(@Nonnull final File aDir); @Nonnull static FileIOError deleteDirRecursiveIfExisting(@Nonnull final File aDir); @Nonnull static FileIOError deleteFile(@Nonnull final File aFile); @Nonnull static FileIOError deleteFileIfExisting(@Nonnull final File aFile); @Nonnull static FileIOError renameFile(@Nonnull final File aSourceFile, @Nonnull final File aTargetFile); @Nonnull static FileIOError renameDir(@Nonnull final File aSourceDir, @Nonnull final File aTargetDir); @Nonnull static FileIOError copyFile(@Nonnull final File aSourceFile, @Nonnull final File aTargetFile); @Nonnull static FileIOError copyDirRecursive(@Nonnull final File aSourceDir, @Nonnull final File aTargetDir); static final boolean DEFAULT_EXCEPTION_ON_DELETE_ROOT; }### Answer:
@Test public void testDeleteFile () { _expectedError (FileOperations.deleteFile (new File ("warum sollte es diese Datei geben")), EFileIOErrorCode.SOURCE_DOES_NOT_EXIST); final File f = new File ("delfile.test"); try { SimpleFileIO.writeFile (f, "abc".getBytes (StandardCharsets.ISO_8859_1)); assertTrue (FileHelper.existsFile (f)); _expectedSuccess (FileOperations.deleteFile (f)); assertFalse (FileHelper.existsFile (f)); _expectedError (FileOperations.deleteFile (f), EFileIOErrorCode.SOURCE_DOES_NOT_EXIST); } finally { FileOperations.deleteFile (f); } try { FileOperations.deleteFile (null); fail (); } catch (final NullPointerException ex) {} }