@Test
public void testOnColumnsChangedEvent() {

    final DataColumnDef col1 = mock(DataColumnDef.class);
    when(col1.getId()).thenReturn("col1");
    when(col1.getColumnType()).thenReturn(ColumnType.LABEL);
    final DataColumnDef col2 = mock(DataColumnDef.class);
    when(col2.getId()).thenReturn("col2");
    when(col2.getColumnType()).thenReturn(ColumnType.NUMBER);
    final List<DataColumnDef> cols = new ArrayList<DataColumnDef>();
    cols.add(col1);
    cols.add(col2);
    final ColumnsChangedEvent event = mock(ColumnsChangedEvent.class);
    when(event.getContext()).thenReturn(columnListEditor);
    when(event.getColumns()).thenReturn(cols);
    presenter.dataSetDef = this.dataSetDef;
    mockPreviewTableCall();
    final Command afterPreviewCommand = mock(Command.class);
    presenter.afterPreviewCommand = afterPreviewCommand;
    presenter.onColumnsChangedEvent(event);
    verify(dataSetDef, times(1)).setColumns(cols);
    verify(loadingBox, times(1)).show();
    verify(loadingBox, times(1)).hide();
    verify(view, times(1)).clearErrorNotification();
    verify(filterEditor, times(1)).init(any(DataSetMetadata.class));
    verify(afterPreviewCommand, times(1)).execute();
    verify(view, times(0)).init(any(DataSetEditor.class));
    verify(view, times(0)).initWidgets(
            any(DataSetDefBasicAttributesEditor.View.class),
            any(IsWidget.class),
            any(DataSetDefColumnsFilterEditor.View.class),
            any(DataSetDefPreviewTable.View.class),
            any(DataSetDefCacheAttributesEditorView.class),
            any(DataSetDefCacheAttributesEditorView.class),
            any(DataSetDefRefreshAttributesEditor.View.class)
    );
    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)).showErrorNotification(any(SafeHtml.class));
}