FolderHandler { public boolean existFolderNameInParentDirectoryPath(String folderName, String parentDirectoryPath) throws IOException { Assert.notNull(parentDirectoryPath); Assert.notNull(folderName); File parentDirectory = new File(parentDirectoryPath); if (!parentDirectory.exists()) { throw new IOException(); } return new File(parentDirectoryPath + File.separator + folderName).exists(); }  void createFolderInParentDirectoryPath(String folderName, String parentDirectoryPath); boolean existFolderNameInParentDirectoryPath(String folderName, String parentDirectoryPath);  }
@Test(expected = IllegalArgumentException.class) public void existFolderNameInParentDirectoryPathShouldThrowIllegalArgumentExceptionWhenFolderNameIsNull() throws IOException { folderHandler.existFolderNameInParentDirectoryPath(null, FOLDER_NAME_PARENT); }
@Test(expected = IllegalArgumentException.class) public void existFolderNameInParentDirectoryPathShouldThrowIllegalArgumentExceptionWhenParentDirectoryPathIsNull() throws IOException { folderHandler.existFolderNameInParentDirectoryPath(FOLDER_NAME_ACTUAL, null); }
@Test(expected = IOException.class) public void existFolderNameInParentDirectoryPathShouldThrowIOExceptionWhenParentDirectoryPathNotExists() throws IOException { folderHandler.existFolderNameInParentDirectoryPath(FOLDER_NAME_ACTUAL, StringUtils.EMPTY); }
@Test public void existFolderNameInParentDirectoryPathShouldReturnFalseWhenFolderNameNotExists() throws IOException { boolean actual = folderHandler.existFolderNameInParentDirectoryPath(FOLDER_NAME_NON_EXISTENT, FOLDER_NAME_PARENT); assertFalse(actual); }
@Test public void existFolderNameInParentDirectoryPathShouldReturnTrueWhenCandidateFolderExists() throws IOException { boolean actual = folderHandler.existFolderNameInParentDirectoryPath(FOLDER_NAME_ACTUAL, FOLDER_NAME_PARENT); assertTrue(actual); }