DataSetEditor implements IsWidget,
                                                                     DataSetDefEditor<T> { protected void showError(final ClientRuntimeError error) { loadingBox.hide(); final String message = error.getCause() != null ? error.getCause() : error.getMessage(); view.showErrorNotification(new SafeHtmlBuilder().appendEscaped(message).toSafeHtml()); errorEvent.fire(new ErrorEvent(this, error)); if (afterPreviewCommand != null) { this.afterPreviewCommand.execute(); } } @Inject  DataSetEditor(final DataSetDefBasicAttributesEditor basicAttributesEditor,
                         final IsWidget providerAttributesEditorView,
                         final DataSetDefColumnsFilterEditor columnsAndFilterEditor,
                         final DataSetDefPreviewTable previewTable,
                         final DataSetDefBackendCacheAttributesEditor backendCacheAttributesEditor,
                         final DataSetDefClientCacheAttributesEditor clientCacheAttributesEditor,
                         final DataSetDefRefreshAttributesEditor refreshEditor,
                         final DataSetClientServices clientServices,
                         final LoadingBox loadingBox,
                         final Event<ErrorEvent> errorEvent,
                         final Event<TabChangedEvent> tabChangedEvent,
                         final View view); void init(); @Override Widget asWidget(); void showConfigurationTab(); void showPreviewTab(); void showAdvancedTab(); @Override void setAcceptableValues(final List<DataColumnDef> acceptableValues); @Override void flush(); @Override void onPropertyChange(final String... paths); @Override void setValue(final T value); @Override void setDelegate(final EditorDelegate<T> delegate); @Override org.dashbuilder.dataset.client.editor.DataSetDefBasicAttributesEditor basicAttributesEditor(); @Override org.dashbuilder.dataset.client.editor.DataSetDefColumnsFilterEditor columnsAndFilterEditor(); @Override DataSetDefBackendCacheAttributesEditor backendCacheEditor(); @Override org.dashbuilder.dataset.client.editor.DataSetDefClientCacheAttributesEditor clientCacheEditor(); @Override org.dashbuilder.dataset.client.editor.DataSetDefRefreshAttributesEditor refreshEditor(); static final String TAB_CONFIGURATION; static final String TAB_PREVIEW; static final String TAB_ADVANCED; public View view; }
@Test public void testShowError() { final ClientRuntimeError error = mock(ClientRuntimeError.class); when(error.getCause()).thenReturn("errorCause"); presenter.afterPreviewCommand = mock(Command.class); presenter.showError(error); verify(loadingBox, times(1)).hide(); verify(view, times(1)).showErrorNotification(any(SafeHtml.class)); verify(errorEvent, times(1)).fire(any(ErrorEvent.class)); verify(presenter.afterPreviewCommand, times(1)).execute(); verify(view, times(0)).addConfigurationTabItemClickHandler(any(Command.class)); verify(view, times(0)).addPreviewTabItemClickHandler(any(Command.class)); verify(view, times(0)).addAdvancedTabItemClickHandler(any(Command.class)); verify(view, times(0)).showConfigurationTab(); verify(view, times(0)).showPreviewTab(); verify(view, times(0)).showAdvancedTab(); verify(view, times(0)).openColumnsFilterPanel(anyString()); verify(view, times(0)).closeColumnsFilterPanel(anyString()); verify(view, times(0)).clearErrorNotification(); }