FilterSettingsManagerImpl implements FilterSettingsManager { @Override public void saveDefaultActiveFilter(String filterKey, final Command callback) { loadMultiGridPreferencesStore(store -> { store.setDefaultGridId(filterKey); preferencesService.call(r -> { if (callback != null) { callback.execute(); } }).saveUserPreferences(store); }); }  @Inject void setMarshaller(final FilterSettingsJSONMarshaller marshaller); @Inject void setPreferencesService(final Caller<UserPreferencesService> preferencesService); @Override void loadSavedFilters(final Consumer<List<SavedFilter>> savedFiltersConsumer); @Override FilterSettings createDefaultFilterSettingsPrototype(); @Override void saveFilterIntoPreferences(final FilterSettings filterSettings,
                                          final Consumer<Boolean> callback); void loadSavedFiltersFromPreferences(final MultiGridPreferencesStore store,
                                                final Consumer<List<SavedFilter>> savedFiltersConsumer); @Override void getFilterSettings(final String key,
                                  final Consumer<FilterSettings> filterSettingsConsumer); @Override void resetDefaultSavedFilters(final Consumer<List<SavedFilter>> savedFiltersConsumer); @Override void removeSavedFilterFromPreferences(final String key, Command command); void defaultActiveFilterInit(final Consumer<FilterSettings> callback); @Override void saveDefaultActiveFilter(String filterKey, final Command callback); static final String FILTER_TABLE_SETTINGS; static final String DEFAULT_FILTER_SETTINGS_KEY; }
@Test public void testSaveDefaultActiveFilter() { String newDefaultFilter = "newDefaultActiveFilter"; Command callbackMock = mock(Command.class); filterSettingsManagerImpl.saveDefaultActiveFilter(newDefaultFilter, callbackMock); verify(userPreferencesServiceMock).loadUserPreferences(GRID_GLOBAL_PREFERENCE_KEY, UserPreferencesType.MULTIGRIDPREFERENCES); verify(userPreferencesServiceMock).saveUserPreferences(multiGridPreferencesStore); verify(multiGridPreferencesStore).setDefaultGridId(newDefaultFilter); verify(callbackMock).execute(); }