IOTools { public void createFolder(final String folder) { Validate.notEmpty(folder, "Folder can not be empty"); final File theFolder = new File(folder); if (!theFolder.exists()) { final boolean success = theFolder.mkdirs(); if (!success) { LOG.log(Level.INFO, "Failed to create folder: " + folder); } } }  void flush(@Nullable final Flushable flushable); void close(@Nullable final Closeable closeable); void createFolder(final String folder);  }
@Test public void createFolderShouldThrowExceptionIfFolderIsNull() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Folder can not be empty"); ioTools.createFolder(null); }
@Test public void createFolderShouldThrowExceptionIfFolderIsEmpty() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Folder can not be empty"); ioTools.createFolder(" "); }
@Test public void createFolderShouldCreateMissingFolders() { final File folder = new File("target/test-folder"); final File subFolder = new File("target/test-folder/sub-folder"); assertFalse(folder.exists()); ioTools.createFolder("target/test-folder/sub-folder"); assertTrue(folder.exists()); assertTrue(subFolder.exists()); folder.deleteOnExit(); subFolder.deleteOnExit(); }