@Override public void onNewFolder(final String name) { File folder = new File(mCurrentPath.path, name); if (folderCreator == null) { folderCreator = new FolderCreator(); } folderCreator.execute(folder.getPath()); }
@Test public void should_create_folder_in_given_parent() throws IOException { File parent = null; File child = null; try { parent = newTemporaryFolder(); String childName = "child"; child = creator.createFolder(parent, childName); assertThat(child).isDirectory(); assertThat(child.getName()).isEqualTo(childName); assertThat(pathOf(child.getParentFile())).isEqualTo(pathOf(parent)); } finally { delete(child, parent); } }
/** * Creates the folder where to save screenshots of failing GUI tests. The name of the folder to * create is 'failed-gui-tests'. If {@link * org.assertj.swing.core.Settings#shouldPreserveScreenshots()} is <code>false</code> and the * folder already exists, it is deleted and recreated again. If it is <code>true</code> the folder * is created if it not yet exists. * * @return the created folder. * @throws org.assertj.core.api.exception.RuntimeIOException if any error occurs when creating the * folder. */ public File createImageFolder() { return folderCreator.createFolder( currentFolder(), FAILED_GUI_TESTS_FOLDER, !shouldPreserveScreenshots()); }