@Test public void setStartDateForUser() throws Exception { NotificationFilterPreferenceProvider provider1 = mock(NotificationFilterPreferenceProvider.class); NotificationFilterPreferenceProvider provider2 = mock(NotificationFilterPreferenceProvider.class); when(componentManager.getInstanceList(NotificationFilterPreferenceProvider.class)) .thenReturn(Arrays.asList(provider1, provider2)); DocumentReference user = new DocumentReference("xwiki", "XWiki", "User"); Date date = new Date(); mocker.getComponentUnderTest().setStartDateForUser(user, date); verify(provider1).setStartDateForUser(eq(user), eq(date)); verify(provider2).setStartDateForUser(eq(user), eq(date)); }
@Override public void setStartDateForUser(DocumentReference user, Date startDate) throws NotificationException { try { List<NotificationFilterPreferenceProvider> providers = componentManager.getInstanceList(NotificationFilterPreferenceProvider.class); for (NotificationFilterPreferenceProvider provider : providers) { provider.setStartDateForUser(user, startDate); } } catch (ComponentLookupException e) { throw new NotificationException(String.format("Unable to set the starting date for filter preferences" + " with user [%s].", user)); } }
DefaultNotificationFilterPreferenceManager implements NotificationFilterPreferenceManager { @Override public void setStartDateForUser(DocumentReference user, Date startDate) throws NotificationException { try { List<NotificationFilterPreferenceProvider> providers = componentManager.getInstanceList(NotificationFilterPreferenceProvider.class); for (NotificationFilterPreferenceProvider provider : providers) { provider.setStartDateForUser(user, startDate); } } catch (ComponentLookupException e) { throw new NotificationException(String.format("Unable to set the starting date for filter preferences" + " with user [%s].", user)); } } }
DefaultNotificationFilterPreferenceManager implements NotificationFilterPreferenceManager { @Override public void setStartDateForUser(DocumentReference user, Date startDate) throws NotificationException { try { List<NotificationFilterPreferenceProvider> providers = componentManager.getInstanceList(NotificationFilterPreferenceProvider.class); for (NotificationFilterPreferenceProvider provider : providers) { provider.setStartDateForUser(user, startDate); } } catch (ComponentLookupException e) { throw new NotificationException(String.format("Unable to set the starting date for filter preferences" + " with user [%s].", user)); } }  }
DefaultNotificationFilterPreferenceManager implements NotificationFilterPreferenceManager { @Override public void setStartDateForUser(DocumentReference user, Date startDate) throws NotificationException { try { List<NotificationFilterPreferenceProvider> providers = componentManager.getInstanceList(NotificationFilterPreferenceProvider.class); for (NotificationFilterPreferenceProvider provider : providers) { provider.setStartDateForUser(user, startDate); } } catch (ComponentLookupException e) { throw new NotificationException(String.format("Unable to set the starting date for filter preferences" + " with user [%s].", user)); } }  @Override Collection<NotificationFilterPreference> getFilterPreferences(DocumentReference user); @Override Stream<NotificationFilterPreference> getFilterPreferences(
            Collection<NotificationFilterPreference> filterPreferences, NotificationFilter filter); @Override Stream<NotificationFilterPreference> getFilterPreferences(
            Collection<NotificationFilterPreference> filterPreferences, NotificationFilter filter,
            NotificationFilterType filterType); @Override Stream<NotificationFilterPreference> getFilterPreferences(
            Collection<NotificationFilterPreference> filterPreferences, NotificationFilter filter,
            NotificationFilterType filterType, NotificationFormat format); @Override void saveFilterPreferences(DocumentReference user, Set<NotificationFilterPreference> filterPreferences); @Override void deleteFilterPreference(DocumentReference user, String filterPreferenceId); @Override void setFilterPreferenceEnabled(DocumentReference user, String filterPreferenceId, boolean enabled); @Override void setStartDateForUser(DocumentReference user, Date startDate); }
DefaultNotificationFilterPreferenceManager implements NotificationFilterPreferenceManager { @Override public void setStartDateForUser(DocumentReference user, Date startDate) throws NotificationException { try { List<NotificationFilterPreferenceProvider> providers = componentManager.getInstanceList(NotificationFilterPreferenceProvider.class); for (NotificationFilterPreferenceProvider provider : providers) { provider.setStartDateForUser(user, startDate); } } catch (ComponentLookupException e) { throw new NotificationException(String.format("Unable to set the starting date for filter preferences" + " with user [%s].", user)); } }  @Override Collection<NotificationFilterPreference> getFilterPreferences(DocumentReference user); @Override Stream<NotificationFilterPreference> getFilterPreferences(
            Collection<NotificationFilterPreference> filterPreferences, NotificationFilter filter); @Override Stream<NotificationFilterPreference> getFilterPreferences(
            Collection<NotificationFilterPreference> filterPreferences, NotificationFilter filter,
            NotificationFilterType filterType); @Override Stream<NotificationFilterPreference> getFilterPreferences(
            Collection<NotificationFilterPreference> filterPreferences, NotificationFilter filter,
            NotificationFilterType filterType, NotificationFormat format); @Override void saveFilterPreferences(DocumentReference user, Set<NotificationFilterPreference> filterPreferences); @Override void deleteFilterPreference(DocumentReference user, String filterPreferenceId); @Override void setFilterPreferenceEnabled(DocumentReference user, String filterPreferenceId, boolean enabled); @Override void setStartDateForUser(DocumentReference user, Date startDate);  }