@Override protected void onOK() { if (configPresenter.validateForSubmit()) { view.hide(); onSuccessCommand.execute(configPresenter.getContainerConfig()); } }
@Override protected void onOK() { if (configPresenter.validateForSubmit()) { view.hide(); onSuccessCommand.execute(configPresenter.getContainerConfig()); } }
@Test public void testOnOKWhenInvalidConfig() { popup.show(TITLE, okCommand, cancelCommand, alreadyInUseNames); when(configPresenter.validateForSubmit()).thenReturn(false); popup.onOK(); verify(configPresenter, times(1)).validateForSubmit(); verify(basePopupView, never()).hide(); verify(okCommand, never()).execute(any()); }
@Test public void testOnOKWhenInvalidConfig() { popup.show(TITLE, okCommand, cancelCommand, alreadyInUseNames); when(configPresenter.validateForSubmit()).thenReturn(false); popup.onOK(); verify(configPresenter, times(1)).validateForSubmit(); verify(basePopupView, never()).hide(); verify(okCommand, never()).execute(any()); }
@Test public void testOnOKWhenValidConfig() { popup.show(TITLE, okCommand, cancelCommand, alreadyInUseNames); ContainerConfig containerConfig = mock(ContainerConfig.class); when(configPresenter.getContainerConfig()).thenReturn(containerConfig); when(configPresenter.validateForSubmit()).thenReturn(true); popup.onOK(); verify(configPresenter, times(1)).validateForSubmit(); verify(basePopupView, times(1)).hide(); verify(okCommand, times(1)).execute(containerConfig); }
@Test public void testOnOKWhenValidConfig() { popup.show(TITLE, okCommand, cancelCommand, alreadyInUseNames); ContainerConfig containerConfig = mock(ContainerConfig.class); when(configPresenter.getContainerConfig()).thenReturn(containerConfig); when(configPresenter.validateForSubmit()).thenReturn(true); popup.onOK(); verify(configPresenter, times(1)).validateForSubmit(); verify(basePopupView, times(1)).hide(); verify(okCommand, times(1)).execute(containerConfig); }
@Test public void testOnCancel() { popup.show(TITLE, okCommand, cancelCommand, alreadyInUseNames); popup.onCancel(); verify(configPresenter, never()).validateForSubmit(); verify(basePopupView, times(1)).hide(); verify(cancelCommand, times(1)).execute(); } }
@Test public void testOnCancel() { popup.show(TITLE, okCommand, cancelCommand, alreadyInUseNames); popup.onCancel(); verify(configPresenter, never()).validateForSubmit(); verify(basePopupView, times(1)).hide(); verify(cancelCommand, times(1)).execute(); } }
assertFalse(presenter.validateForSubmit()); verify(view, times(1)).showFormError(ERROR_MESSAGE); when(provisioningValidationService.isValidContainerName(CONTAINER_NAME_VALUE)).thenReturn(true); presenter.onContainerNameChange(); assertFalse(presenter.validateForSubmit()); verify(view, times(2)).showFormError(ERROR_MESSAGE); assertFalse(presenter.validateForSubmit()); verify(view, times(3)).showFormError(ERROR_MESSAGE); assertFalse(presenter.validateForSubmit()); verify(view, times(4)).showFormError(ERROR_MESSAGE); assertTrue(presenter.validateForSubmit()); verify(view, times(4)).showFormError(ERROR_MESSAGE);
assertFalse(presenter.validateForSubmit()); verify(view, times(1)).showFormError(ERROR_MESSAGE); when(provisioningValidationService.isValidContainerName(CONTAINER_NAME_VALUE)).thenReturn(true); presenter.onContainerNameChange(); assertFalse(presenter.validateForSubmit()); verify(view, times(2)).showFormError(ERROR_MESSAGE); assertFalse(presenter.validateForSubmit()); verify(view, times(3)).showFormError(ERROR_MESSAGE); assertFalse(presenter.validateForSubmit()); verify(view, times(4)).showFormError(ERROR_MESSAGE); assertTrue(presenter.validateForSubmit()); verify(view, times(4)).showFormError(ERROR_MESSAGE);