GithubImporterPagePresenter extends AbstractWizardPage<ImportProject> implements GithubImporterPageView.ActionDelegate { @Override public void projectNameChanged(@NotNull String name) { dataObject.getProject().setName(name); updateDelegate.updateControls(); validateProjectName(); } @Inject  GithubImporterPagePresenter(GithubImporterPageView view,
                                       GitHubAuthenticator gitHubAuthenticator,
                                       NotificationManager notificationManager,
                                       GitHubClientService gitHubClientService,
                                       DtoFactory dtoFactory,
                                       GitHubLocalizationConstant 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); @Override void onLoadRepoClicked(); @Override void onRepositorySelected(@NotNull ProjectData repository); @Override void onAccountChanged();  }
@Test public void correctProjectNameEnteredTest() { String correctName = "angularjs"; when(view.getProjectName()).thenReturn(correctName); presenter.projectNameChanged(correctName); verify(newProject).setName(eq(correctName)); verify(view).hideNameError(); verify(view, never()).showNameError(); verify(updateDelegate).updateControls(); }
@Test public void correctProjectNameWithPointEnteredTest() { String correctName = "Test.project..ForCodenvy"; when(view.getProjectName()).thenReturn(correctName); presenter.projectNameChanged(correctName); verify(newProject).setName(eq(correctName)); verify(view).hideNameError(); verify(view, never()).showNameError(); verify(updateDelegate).updateControls(); }
@Test public void emptyProjectNameEnteredTest() { String emptyName = ""; when(view.getProjectName()).thenReturn(emptyName); presenter.projectNameChanged(emptyName); verify(newProject).setName(eq(emptyName)); verify(updateDelegate).updateControls(); }
@Test public void incorrectProjectNameEnteredTest() { String incorrectName = "angularjs+"; when(view.getProjectName()).thenReturn(incorrectName); presenter.projectNameChanged(incorrectName); verify(newProject).setName(eq(incorrectName)); verify(view).showNameError(); verify(updateDelegate).updateControls(); }