GitImporterPagePresenter extends AbstractWizardPage<ImportProject> implements GitImporterPageView.ActionDelegate { @Override public void keepDirectorySelected(boolean keepDirectory) { view.enableDirectoryNameField(keepDirectory); if (keepDirectory) { projectParameters().put("keepDirectory", view.getDirectoryName()); dataObject.getProject().withType("blank"); view.highlightDirectoryNameField(!NameUtils.checkProjectName(view.getDirectoryName())); view.focusDirectoryNameFiend(); } else { projectParameters().remove("keepDirectory"); dataObject.getProject().withType(null); view.highlightDirectoryNameField(false); } } @Inject  GitImporterPagePresenter(GitImporterPageView view,
                                    GitLocalizationConstant locale); @Override boolean isCompleted(); @Override void projectNameChanged(@NotNull String name); @Override void projectUrlChanged(@NotNull String url); @Override void recursiveSelected(boolean recursiveSelected); @Override void projectDescriptionChanged(@NotNull String projectDescription); @Override void projectVisibilityChanged(boolean visible); @Override void keepDirectorySelected(boolean keepDirectory); @Override void keepDirectoryNameChanged(@NotNull String directoryName); @Override void go(@NotNull AcceptsOneWidget container);  }
@Test public void keepDirectorySelectedTest() { presenter.keepDirectorySelected(true); verify(view).enableDirectoryNameField(true); }
@Test public void keepDirectoryNotSelectedTest() { presenter.keepDirectorySelected(false); verify(view).enableDirectoryNameField(false); }
@Test public void emptyDirectoryNameEnteredTest() { when(view.getDirectoryName()).thenReturn(""); presenter.keepDirectorySelected(true); verify(view).highlightDirectoryNameField(true); }
@Test public void directoryNameEnteredTest() { when(view.getDirectoryName()).thenReturn("test"); presenter.keepDirectorySelected(true); verify(view).highlightDirectoryNameField(false); }