@Test public void createDirectoryRecursivelyShouldThrowExceptionDirDoesNotExist() { try { OdeFileUtils.createDirectoryRecursively(dir); fail("Expected IOException directory does not exist"); } catch (Exception e) { assertEquals(IOException.class, e.getClass()); assertEquals("Failed to verify directory creation - directory does not exist.", e.getMessage()); } }
public static void createDirectoryRecursively(Path dir) throws IOException { try { Files.createDirectories(dir); } catch (IOException e) { throw new IOException("Exception while trying to create directory: " + e); } if (!dir.toFile().exists()) { throw new IOException("Failed to verify directory creation - directory does not exist."); } }
OdeFileUtils { public static void createDirectoryRecursively(Path dir) throws IOException { try { Files.createDirectories(dir); } catch (IOException e) { throw new IOException("Exception while trying to create directory: " + e); } if (!dir.toFile().exists()) { throw new IOException("Failed to verify directory creation - directory does not exist."); } } }
OdeFileUtils { public static void createDirectoryRecursively(Path dir) throws IOException { try { Files.createDirectories(dir); } catch (IOException e) { throw new IOException("Exception while trying to create directory: " + e); } if (!dir.toFile().exists()) { throw new IOException("Failed to verify directory creation - directory does not exist."); } } private  OdeFileUtils(); }
OdeFileUtils { public static void createDirectoryRecursively(Path dir) throws IOException { try { Files.createDirectories(dir); } catch (IOException e) { throw new IOException("Exception while trying to create directory: " + e); } if (!dir.toFile().exists()) { throw new IOException("Failed to verify directory creation - directory does not exist."); } } private  OdeFileUtils(); static void createDirectoryRecursively(Path dir); static void backupFile(Path file, Path backupDir); static void moveFile(Path file, Path destination); }
OdeFileUtils { public static void createDirectoryRecursively(Path dir) throws IOException { try { Files.createDirectories(dir); } catch (IOException e) { throw new IOException("Exception while trying to create directory: " + e); } if (!dir.toFile().exists()) { throw new IOException("Failed to verify directory creation - directory does not exist."); } } private  OdeFileUtils(); static void createDirectoryRecursively(Path dir); static void backupFile(Path file, Path backupDir); static void moveFile(Path file, Path destination);  }