protected void assertNotification(final NotificationEvent.NotificationType notificationType) { final ArgumentCaptor<NotificationEvent> captor = ArgumentCaptor.forClass(NotificationEvent.class); verify(notification).fire(captor.capture()); assertEquals(notificationType, captor.getValue().getType()); } }
protected void assertNotification(final NotificationEvent.NotificationType notificationType) { final ArgumentCaptor<NotificationEvent> captor = ArgumentCaptor.forClass(NotificationEvent.class); verify(notification).fire(captor.capture()); assertEquals(notificationType, captor.getValue().getType()); } }
@Test public void testCreateInvalidCaseInstance() { presenter.createCaseInstance(null, anyString(), null); final ArgumentCaptor<NotificationEvent> captor = ArgumentCaptor.forClass(NotificationEvent.class); verify(notificationEvent).fire(captor.capture()); assertEquals(1, captor.getAllValues().size()); assertEquals(NotificationEvent.NotificationType.ERROR, captor.getValue().getType()); }
@Test public void testCreateInvalidCaseInstance() { presenter.createCaseInstance(null, anyString(), null); final ArgumentCaptor<NotificationEvent> captor = ArgumentCaptor.forClass(NotificationEvent.class); verify(notificationEvent).fire(captor.capture()); assertEquals(1, captor.getAllValues().size()); assertEquals(NotificationEvent.NotificationType.ERROR, captor.getValue().getType()); }
@Test public void testNotificationOnStartProcessWithJavaScriptObject() { ftlStartProcessDisplayer.startProcess( mock( JavaScriptObject.class ) ); verify( newProcessInstanceEvent ).fire( any( NewProcessInstanceEvent.class ) ); ArgumentCaptor<NotificationEvent> argument = ArgumentCaptor.forClass( NotificationEvent.class ); verify( notificationEvent ).fire( argument.capture() ); assertEquals( NotificationEvent.NotificationType.SUCCESS, argument.getValue().getType() ); } }
@Test public void testOnValidateFailed() { when(editWorkflow.hasErrors()).thenReturn(true); presenter.getValidateCommand().execute(); verify(editWorkflow, times(1)).flush(); final ArgumentCaptor<NotificationEvent> dataCaptor = ArgumentCaptor.forClass(NotificationEvent.class); verify(notification, times(1)).fire(dataCaptor.capture()); NotificationEvent ne = dataCaptor.getValue(); assertNotNull(ne); assertEquals(NotificationEvent.NotificationType.ERROR, ne.getType()); }
@Test public void testRemoveError() { final ServerInstanceKey serverInstanceKey = new ServerInstanceKey( "templateId", "serverName", "serverInstanceId", "url" ); presenter.onSelect( new ServerInstanceSelected( serverInstanceKey ) ); doThrow( new RuntimeException() ).when( specManagementService ).deleteServerInstance( serverInstanceKey ); presenter.remove(); final ArgumentCaptor<NotificationEvent> notificationCaptor = ArgumentCaptor.forClass( NotificationEvent.class ); verify( notification ).fire( notificationCaptor.capture() ); assertEquals( NotificationEvent.NotificationType.ERROR, notificationCaptor.getValue().getType() ); }
@Test public void testOnValidateSuccess() { when(editWorkflow.hasErrors()).thenReturn(false); presenter.getValidateCommand().execute(); verify(editWorkflow, times(1)).flush(); final ArgumentCaptor<NotificationEvent> dataCaptor = ArgumentCaptor.forClass(NotificationEvent.class); verify(notification, times(1)).fire(dataCaptor.capture()); NotificationEvent ne = dataCaptor.getValue(); assertNotNull(ne); assertEquals(NotificationEvent.NotificationType.SUCCESS, ne.getType()); }
@Test public void testOnValidateFailed() { when(editWorkflow.hasErrors()).thenReturn(true); presenter.getValidateCommand().execute(); verify(editWorkflow, times(1)).flush(); final ArgumentCaptor<NotificationEvent> dataCaptor = ArgumentCaptor.forClass(NotificationEvent.class); verify(notification, times(1)).fire(dataCaptor.capture()); NotificationEvent ne = dataCaptor.getValue(); assertNotNull(ne); assertEquals(NotificationEvent.NotificationType.ERROR, ne.getType()); }
@Test public void testOnValidateSuccess() { when(editWorkflow.hasErrors()).thenReturn(false); presenter.getValidateCommand().execute(); verify(editWorkflow, times(1)).flush(); final ArgumentCaptor<NotificationEvent> dataCaptor = ArgumentCaptor.forClass(NotificationEvent.class); verify(notification, times(1)).fire(dataCaptor.capture()); NotificationEvent ne = dataCaptor.getValue(); assertNotNull(ne); assertEquals(NotificationEvent.NotificationType.SUCCESS, ne.getType()); }
@Test public void testNotificationOnStartProcess() { getStartProcessFormDisplayer().setParentProcessInstanceId( 0L ); getStartProcessFormDisplayer().startProcess( new HashMap<String, Object>() ); verify( newProcessInstanceEvent ).fire( any( NewProcessInstanceEvent.class ) ); ArgumentCaptor<NotificationEvent> argument = ArgumentCaptor.forClass( NotificationEvent.class ); verify( notificationEvent ).fire( argument.capture() ); assertEquals( NotificationEvent.NotificationType.SUCCESS, argument.getValue().getType() ); } }
@Test public void testNotificationOnStartProcess() { getStartProcessFormDisplayer().setParentProcessInstanceId(0L); getStartProcessFormDisplayer().startProcess(new HashMap<String, Object>()); verify(newProcessInstanceEvent).fire(any(NewProcessInstanceEvent.class)); ArgumentCaptor<NotificationEvent> argument = ArgumentCaptor.forClass(NotificationEvent.class); verify(notificationEvent).fire(argument.capture()); assertEquals(NotificationEvent.NotificationType.SUCCESS, argument.getValue().getType()); } }
@Override public NotificationPopupHandle show(NotificationEvent event, Command hideCommand) { if (container == null) { throw new IllegalStateException("The setContainer() method hasn't been called!"); } final NotificationPopupView view = new NotificationPopupView(); final PopupHandle popupHandle = new PopupHandle(view, event); activeNotifications.add(popupHandle); int size = activeNotifications.size(); int topMargin = (size == 1) ? initialSpacing : (size * SPACING) - (SPACING - initialSpacing); view.setPopupPosition(getLeftPosition(container.asWidget()) + getMargin(), getTopPosition(container.asWidget()) + topMargin); view.setNotification(event.getNotification()); view.setType(event.getType()); view.setNotificationWidth(getWidth() + "px"); view.show(hideCommand); return popupHandle; }
@Override public NotificationPopupHandle show( NotificationEvent event, Command hideCommand ) { if ( container == null ) { throw new IllegalStateException( "The setContainer() method hasn't been called!" ); } final NotificationPopupView view = new NotificationPopupView(); final PopupHandle popupHandle = new PopupHandle( view, event ); activeNotifications.add( popupHandle ); int size = activeNotifications.size(); int topMargin = (size == 1) ? initialSpacing : (size * SPACING) - (SPACING - initialSpacing); view.setPopupPosition( getLeftPosition( container.asWidget() ) + getMargin(), getTopPosition( container.asWidget() ) + topMargin ); view.setNotification( event.getNotification() ); view.setType( event.getType() ); view.setNotificationWidth( getWidth() + "px" ); view.show( hideCommand ); return popupHandle; }
@Override public NotificationPopupHandle show(NotificationEvent event, Command hideCommand) { if (container == null) { throw new IllegalStateException("The setContainer() method hasn't been called!"); } final NotificationPopupView view = new NotificationPopupView(); final PopupHandle popupHandle = new PopupHandle(view, event); activeNotifications.add(popupHandle); int size = activeNotifications.size(); int topMargin = (size == 1) ? initialSpacing : (size * SPACING) - (SPACING - initialSpacing); view.setPopupPosition(getLeftPosition(container.asWidget()) + getMargin(), getTopPosition(container.asWidget()) + topMargin); view.setNotification(event.getNotification()); view.setType(event.getType()); view.setNotificationWidth(getWidth() + "px"); view.show(hideCommand); return popupHandle; }
captor.getAllValues().size()); assertEquals(NotificationEvent.NotificationType.DEFAULT, captor.getAllValues().get(0).getType()); assertEquals(NotificationEvent.NotificationType.DEFAULT, captor.getAllValues().get(1).getType()); assertEquals(Constants.INSTANCE.RequestScheduled(firstJobId), captor.getAllValues().get(0).getNotification());
final NotificationEvent event = notificationCaptor.getValue(); assertEquals(NotificationEvent.NotificationType.SUCCESS, event.getType()); assertEquals(successMessage, event.getNotification());
final NotificationEvent event = eventCaptor.getValue(); assertEquals( successMessage, event.getNotification() ); assertEquals( NotificationEvent.NotificationType.SUCCESS, event.getType() );
@Test public void confirmPopupTest() { final ProcessInstanceSummary summary = ProcessInstanceSummary.builder().withServerTemplateId(SERVER_TEMPLATE_ID).withDeploymentId(PI_DEPLOYMENT_ID).withProcessInstanceId(PI_ID).withState(1).build(); when(processRuntimeDataService.getProcessInstance(any())).thenReturn(summary); presenter.onProcessSelectionEvent(new ProcessInstanceSelectionEvent(summary.getProcessInstanceKey(), true)); presenter.openAbortProcessInstancePopup(); ArgumentCaptor<Command> captureCommand = ArgumentCaptor.forClass(Command.class); verify(confirmPopup).show(any(), any(), any(), captureCommand.capture()); remoteProcessServiceCaller = new CallerMock<>(processService); presenter.setProcessService(remoteProcessServiceCaller); captureCommand.getValue().execute(); final ArgumentCaptor<NotificationEvent> captor = ArgumentCaptor.forClass(NotificationEvent.class); verify(notificationEvent).fire(captor.capture()); assertEquals(1, captor.getAllValues().size()); assertEquals(NotificationEvent.NotificationType.DEFAULT, captor.getValue().getType()); assertEquals(Constants.INSTANCE.Aborting_Process_Instance(PI_ID), captor.getValue().getNotification()); verify(processService).abortProcessInstance(new ProcessInstanceKey(SERVER_TEMPLATE_ID, PI_DEPLOYMENT_ID, PI_ID)); }