@Test public void testValidateForSubmit() { when(translationService.getTranslation(ContainerConfigPresenter_AllFieldsMustBeCompletedErrorMessage)).thenReturn(ERROR_MESSAGE); presenter.clear(); assertFalse(presenter.validateForSubmit()); verify(view, times(1)).showFormError(ERROR_MESSAGE); verify(view, never()).clearFormError(); when(view.getContainerName()).thenReturn(CONTAINER_NAME_VALUE); when(provisioningValidationService.isValidContainerName(CONTAINER_NAME_VALUE)).thenReturn(true); presenter.onContainerNameChange(); assertFalse(presenter.validateForSubmit()); verify(view, times(2)).showFormError(ERROR_MESSAGE); verify(view, times(1)).clearFormError(); when(view.getGroupId()).thenReturn(GROUP_ID_VALUE); assertFalse(presenter.validateForSubmit()); verify(view, times(3)).showFormError(ERROR_MESSAGE); verify(view, times(1)).clearFormError(); when(view.getArtifactId()).thenReturn(ARTIFACT_ID_VALUE); assertFalse(presenter.validateForSubmit()); verify(view, times(4)).showFormError(ERROR_MESSAGE); verify(view, times(1)).clearFormError(); when(view.getVersion()).thenReturn(VERSION_VALUE); assertTrue(presenter.validateForSubmit()); verify(view, times(4)).showFormError(ERROR_MESSAGE); verify(view, times(2)).clearFormError(); }
public boolean validateForSubmit() { boolean isValid = isValidContainerName() && isValidGroupId() && isValidArtifactId() && isValidVersion(); if (!isValid) { view.showFormError(translationService.getTranslation(ContainerConfigPresenter_AllFieldsMustBeCompletedErrorMessage)); } else { view.clearFormError(); } return isValid; }
ContainerConfigPresenter { public boolean validateForSubmit() { boolean isValid = isValidContainerName() && isValidGroupId() && isValidArtifactId() && isValidVersion(); if (!isValid) { view.showFormError(translationService.getTranslation(ContainerConfigPresenter_AllFieldsMustBeCompletedErrorMessage)); } else { view.clearFormError(); } return isValid; } }
ContainerConfigPresenter { public boolean validateForSubmit() { boolean isValid = isValidContainerName() && isValidGroupId() && isValidArtifactId() && isValidVersion(); if (!isValid) { view.showFormError(translationService.getTranslation(ContainerConfigPresenter_AllFieldsMustBeCompletedErrorMessage)); } else { view.clearFormError(); } return isValid; } @Inject  ContainerConfigPresenter(final View view,
                                    final ArtifactSelectorPresenter artifactSelector,
                                    final TranslationService translationService,
                                    final PopupHelper popupHelper,
                                    final Caller<M2RepoService> m2RepoService,
                                    final ProvisioningClientValidationService validationService); }
ContainerConfigPresenter { public boolean validateForSubmit() { boolean isValid = isValidContainerName() && isValidGroupId() && isValidArtifactId() && isValidVersion(); if (!isValid) { view.showFormError(translationService.getTranslation(ContainerConfigPresenter_AllFieldsMustBeCompletedErrorMessage)); } else { view.clearFormError(); } return isValid; } @Inject  ContainerConfigPresenter(final View view,
                                    final ArtifactSelectorPresenter artifactSelector,
                                    final TranslationService translationService,
                                    final PopupHelper popupHelper,
                                    final Caller<M2RepoService> m2RepoService,
                                    final ProvisioningClientValidationService validationService); @PostConstruct void init(); IsElement getView(); void clear(); void setup(final List<String> alreadyInUseNames); boolean validateForSubmit(); ContainerConfig getContainerConfig(); }
ContainerConfigPresenter { public boolean validateForSubmit() { boolean isValid = isValidContainerName() && isValidGroupId() && isValidArtifactId() && isValidVersion(); if (!isValid) { view.showFormError(translationService.getTranslation(ContainerConfigPresenter_AllFieldsMustBeCompletedErrorMessage)); } else { view.clearFormError(); } return isValid; } @Inject  ContainerConfigPresenter(final View view,
                                    final ArtifactSelectorPresenter artifactSelector,
                                    final TranslationService translationService,
                                    final PopupHelper popupHelper,
                                    final Caller<M2RepoService> m2RepoService,
                                    final ProvisioningClientValidationService validationService); @PostConstruct void init(); IsElement getView(); void clear(); void setup(final List<String> alreadyInUseNames); boolean validateForSubmit(); ContainerConfig getContainerConfig();  }