AdvancedFiltersPresenter { @OnOpen public void onOpen() { initAdvancedFilters(); }  @WorkbenchPartView AdvancedFilterEditor getView(); @WorkbenchPartTitle String getTitle(); @OnOpen void onOpen(); abstract String getAdvancedFiltersEditorScreenId(); @Inject void setAdvancedFilterEditorView(AdvancedFilterEditor advancedFilterEditorView); @Inject void setSavedFilterSelectedEvent(Event<SavedFilterSelectedEvent> savedFilterSelectedEvent); @Inject void setNotificationEvent(Event<NotificationEvent> notificationEvent); @Inject void setPlaceManager(PlaceManager placeManager); void displayNotification(String text);  }
@Test public void testSuccessfulSaveAdvancedFilters() { presenter.onOpen(); ArgumentCaptor<Consumer> captor = ArgumentCaptor.forClass(Consumer.class); verify(advancedFilterEditorView).init(any(), captor.capture()); final FilterSettings filterSettings = new FilterSettings(); captor.getValue().accept(filterSettings); ArgumentCaptor<Consumer> captor2 = ArgumentCaptor.forClass(Consumer.class); verify(filterSettingsManager).saveFilterIntoPreferences(eq(filterSettings), captor2.capture()); captor2.getValue().accept(true); verify(savedFilterEvent).fire(any()); }
@Test public void testUnsuccessfulSaveAdvancedFilters() { presenter.onOpen(); ArgumentCaptor<Consumer> captor = ArgumentCaptor.forClass(Consumer.class); verify(advancedFilterEditorView).init(any(), captor.capture()); final FilterSettings filterSettings = new FilterSettings(); captor.getValue().accept(filterSettings); ArgumentCaptor<Consumer> captor2 = ArgumentCaptor.forClass(Consumer.class); verify(filterSettingsManager).saveFilterIntoPreferences(eq(filterSettings), captor2.capture()); captor2.getValue().accept(false); verifyNoMoreInteractions(savedFilterEvent); verify(advancedFilterEditorView).setTableNameError(anyString()); }