### Question:
FileOperations { @Nonnull public static FileIOError createDirRecursive (@Nonnull final File aDir) { ValueEnforcer.notNull (aDir, "Directory"); if (aDir.exists ()) return EFileIOErrorCode.TARGET_ALREADY_EXISTS.getAsIOError (EFileIOOperation.CREATE_DIR_RECURSIVE, aDir); final File aParentDir = aDir.getParentFile (); if (aParentDir != null && aParentDir.exists () && !aParentDir.canWrite ()) return EFileIOErrorCode.SOURCE_PARENT_NOT_WRITABLE.getAsIOError (EFileIOOperation.CREATE_DIR_RECURSIVE, aDir); try { final EFileIOErrorCode eError = aDir.mkdirs () ? EFileIOErrorCode.NO_ERROR : EFileIOErrorCode.OPERATION_FAILED; return eError.getAsIOError (EFileIOOperation.CREATE_DIR_RECURSIVE, aDir); } catch (final SecurityException ex) { return EFileIOErrorCode.getSecurityAsIOError (EFileIOOperation.CREATE_DIR_RECURSIVE, 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 testCreateDirRecursive () { final File aDir1 = new File ("TestDir"); final File aDir11 = new File (aDir1, "TestSubDir"); assertFalse (FileHelper.existsDir (aDir1)); assertFalse (FileHelper.existsDir (aDir11)); _expectedSuccess (FileOperations.createDirRecursive (aDir11)); try { assertTrue (FileHelper.existsDir (aDir1)); assertTrue (FileHelper.existsDir (aDir11)); _expectedError (FileOperations.createDirRecursive (aDir1), EFileIOErrorCode.TARGET_ALREADY_EXISTS); _expectedError (FileOperations.createDirRecursive (aDir11), EFileIOErrorCode.TARGET_ALREADY_EXISTS); } finally { _expectedSuccess (FileOperations.deleteDirRecursive (aDir1)); assertFalse (FileHelper.existsDir (aDir11)); assertFalse (FileHelper.existsDir (aDir1)); _expectedError (FileOperations.deleteDirRecursive (aDir1), EFileIOErrorCode.SOURCE_DOES_NOT_EXIST); } _expectedError (FileOperations.createDirRecursive (new File ("\0")), EFileIOErrorCode.OPERATION_FAILED); try { FileOperations.createDirRecursive (null); fail (); } catch (final NullPointerException ex) {} }