DataSetDefWizardScreen { void onCancelEvent(@Observes CancelRequestEvent cancelEvent) { checkNotNull("cancelEvent", cancelEvent); if (cancelEvent.getContext().equals(currentWorkflow)) { providerTypeEdition(); } } @Inject  DataSetDefWizardScreen(final SyncBeanManager beanManager,
                                  final DataSetEditorWorkflowFactory workflowFactory,
                                  final Caller<DataSetDefVfsServices> services,
                                  final DataSetClientServices clientServices,
                                  final Event<NotificationEvent> notification,
                                  final PlaceManager placeManager,
                                  final ErrorPopupPresenter errorPopupPresenter,
                                  final SavePopUpPresenter savePopUpPresenter,
                                  final DataSetDefScreenView view); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsWidget getView(); @OnStartup void init(PlaceRequest placeRequest); @OnClose void onClose(); void completeEdition(final DataSetDef dataSetDef,
                                final DataSet dataset); public DataSetDefScreenView view; }
@Test public void testOnCancelEvent() { presenter.currentWorkflow = dataSetBasicAttributesWorkflow; CancelRequestEvent event = mock(CancelRequestEvent.class); when(event.getContext()).thenReturn(dataSetBasicAttributesWorkflow); presenter.onCancelEvent(event); verify(workflowFactory, times(1)).providerType(); verify(workflowFactory, times(0)).edit(any(DataSetProviderType.class)); verify(workflowFactory, times(0)).basicAttributes(any(DataSetProviderType.class)); }