SubversionProjectImporterPresenter extends AbstractWizardPage<ImportProject> implements SubversionProjectImporterView.ActionDelegate { @Override public void onProjectNameChanged() { dataObject.getProject().setName(view.getProjectName()); updateDelegate.updateControls(); view.setNameErrorVisibility(!NameUtils.checkProjectName(view.getProjectName())); } @Inject  SubversionProjectImporterPresenter(SubversionProjectImporterView view); @Override void go(AcceptsOneWidget container); @Override void onProjectNameChanged(); @Override void onProjectUrlChanged(); @Override void onProjectRelativePathChanged(); @Override void onProjectDescriptionChanged(); @Override void onProjectVisibilityChanged(); @Override void onCredentialsChanged(); static final String PUBLIC_VISIBILITY; static final String PRIVATE_VISIBILITY; }
@Test public void testEmptyProjectName() throws Exception { final String projectName = ""; when(view.getProjectName()).thenReturn(projectName); presenter.onProjectNameChanged(); verify(dataObject.getProject()).setName(eq(projectName)); verify(updateDelegate).updateControls(); verify(view).setNameErrorVisibility(eq(true)); }
@Test public void testInvalidProjectName() throws Exception { final String projectName = "+subversion+"; when(view.getProjectName()).thenReturn(projectName); presenter.onProjectNameChanged(); verify(dataObject.getProject()).setName(eq(projectName)); verify(updateDelegate).updateControls(); verify(view).setNameErrorVisibility(eq(true)); }
@Test public void testValidProjectName() throws Exception { final String projectName = "subversion"; when(view.getProjectName()).thenReturn(projectName); presenter.onProjectNameChanged(); verify(dataObject.getProject()).setName(eq(projectName)); verify(updateDelegate).updateControls(); verify(view).setNameErrorVisibility(eq(false)); }