AbstractMultiGridPresenter extends AbstractScreenListPresenter<T> { public void saveSearchFilterSettings(final String filterName, final Consumer<String> callback) { final FilterSettings settings = getDataSetQueryHelper().getCurrentTableSettings(); settings.setTableName(filterName); settings.setTableDescription(filterName); filterSettingsManager.saveFilterIntoPreferences(settings, state -> { if (state) { getListView().getListGrid().getGridPreferencesStore().setPreferenceKey(settings.getKey()); getListView().getListGrid().saveGridToUserPreferences(); callback.accept(null); } else { callback.accept(Constants.INSTANCE.FilterWithSameNameAlreadyExists()); } }); }  @Inject void setErrorHandlerBuilder(final ManagedInstance<ErrorHandlerBuilder> errorHandlerBuilder); @Inject void setAuthorizationManager(final AuthorizationManager authorizationManager); @Inject void setDataSetQueryHelper(final DataSetQueryHelper dataSetQueryHelper); @Inject void setClearAllActiveFiltersEvent(Event<ClearAllActiveFiltersEvent> clearAllActiveFiltersEvent); void setFilterSettingsManager(final FilterSettingsManager filterSettingsManager); DataSetQueryHelper getDataSetQueryHelper(); @WorkbenchPartView UberView<T> getView(); @Inject void setView(V view); abstract void setupActiveSearchFilters(); abstract boolean existActiveSearchFilters(); @PostConstruct void init(); @Override @OnOpen void onOpen(); Predicate<String> getFilterEventPredicate(); void onBasicFilterAddEvent(@Observes final BasicFilterAddEvent event); void onBasicFilterRemoveEvent(@Observes final BasicFilterRemoveEvent event); ActiveFilterItem getActiveFilterFromColumnFilter(ColumnFilter columnFilter); @Override void getData(final Range visibleRange); void saveSearchFilterSettings(final String filterName,
                                         final Consumer<String> callback); boolean isUserAuthorizedForPerspective(final String perspectiveId); void openErrorView(final String parameterId); Predicate<T> getViewErrorsActionCondition();  }
@Test public void testSaveSearchFilterSettings() { String key = "key"; ListTable listTable = mock(ListTable.class); GridPreferencesStore gridPreferencesStore = mock(GridPreferencesStore.class); when(dataSetQueryHelper.getCurrentTableSettings()).thenReturn(filterSettingsMock); when(filterSettingsMock.getKey()).thenReturn(key); when(listView.getListGrid()).thenReturn(listTable); when(listTable.getGridPreferencesStore()).thenReturn(gridPreferencesStore); presenter.saveSearchFilterSettings("filterName", mock(Consumer.class)); ArgumentCaptor<Consumer> booleanConsumerCaptor = ArgumentCaptor.forClass(Consumer.class); verify(filterSettingsManager).saveFilterIntoPreferences(eq(filterSettingsMock), booleanConsumerCaptor.capture()); booleanConsumerCaptor.getValue().accept(true); verify(gridPreferencesStore).setPreferenceKey(key); verify(listTable).saveGridToUserPreferences(); }