### Question:
DefaultNotificationPreferenceManager implements NotificationPreferenceManager { @Override public void savePreferences(List<NotificationPreference> preferences) throws NotificationException { Map<String, List<NotificationPreference>> preferencesMapping = new HashMap<>(); for (NotificationPreference notificationPreference : preferences) { String providerHint = notificationPreference.getProviderHint(); if (componentManager.hasComponent(NotificationPreferenceProvider.class, providerHint)) { if (!preferencesMapping.containsKey(providerHint)) { preferencesMapping.put(providerHint, new ArrayList<>()); } preferencesMapping.get(providerHint).add(notificationPreference); } } for (String providerHint : preferencesMapping.keySet()) { try { NotificationPreferenceProvider provider = componentManager.getInstance(NotificationPreferenceProvider.class, providerHint); provider.savePreferences(preferencesMapping.get(providerHint)); } catch (ComponentLookupException e) { logger.error("Unable to retrieve the notification preference provide for hint {}: {}", providerHint, e); } } }  @Override List<NotificationPreference> getAllPreferences(DocumentReference user); @Override List<NotificationPreference> getAllPreferences(WikiReference wiki); @Override List<NotificationPreference> getPreferences(DocumentReference user, boolean isEnabled,
            NotificationFormat format); @Override void setStartDateForUser(DocumentReference user, Date startDate); @Override void savePreferences(List<NotificationPreference> preferences);  }### Answer:
@Test public void saveNotificationsPreferences() throws Exception { mockPreferenceProviders(new DocumentReference("xwiki", "test", "user")); mocker.getComponentUnderTest() .savePreferences( Arrays.asList(mockPreference11, mockPreference12, mockPreference21, mockPreference22)); verify(mockPreferenceProvider1, times(1)) .savePreferences(eq(Arrays.asList(mockPreference11, mockPreference12))); }