DataSetDefEditorPresenter extends BaseEditor { @Override protected Command onValidate() { return () -> { workflow.flush(); if (!workflow.hasErrors()) { notification.fire(new NotificationEvent(DataSetAuthoringConstants.INSTANCE.validationOk(), SUCCESS)); } else { notification.fire(new NotificationEvent(DataSetAuthoringConstants.INSTANCE.validationFailed(), ERROR)); } }; }  @OnStartup void onStartup(final ObservablePath path,
                          final PlaceRequest place); @WorkbenchPartTitleDecoration IsWidget getTitle(); @WorkbenchPartTitle String getTitleText(); @WorkbenchMenu Menus getMenus(); @WorkbenchPartView Widget getWidget(); @OnMayClose boolean onMayClose(); @OnClose void onClose(); DataSetDef getDataSetDef(); int getCurrentModelHash(); void disposeWorkflow(); @Inject
    public DataSetDefScreenView view; }
@Test public void testOnValidateSuccess() { when(editWorkflow.hasErrors()).thenReturn(false); presenter.onValidate().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.onValidate().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()); }