Source:
public void handlerUsersParameterWhenOnlyTheUserParameterIsGiven() throws NotificationException { final DocumentReference testUser = new DocumentReference("currentwiki", "XWiki", "SomeUser"); NotificationParameters notificationParameters = notificationParametersForUser(testUser); NotificationParameters expectedParameters = notificationParametersForUser(testUser); expectedParameters.filters = Collections.emptyList(); expectedParameters.filterPreferences = Collections.emptyList(); this.usersParameterHandler.handleUsersParameter("", notificationParameters); assertEquals(expectedParameters, notificationParameters); List<NotificationFilterPreference> userFilterPreferences = new ArrayList<>(); userFilterPreferences.add(getFilterPreference("currentwiki:XWiki.SomeUser")); NotificationFilterPreference userFollowingFilterPref1 = getFilterPreferenceWithName( "currentwiki:XWiki.Alice", "eventUserNotificationFilter"); userFilterPreferences.add(userFollowingFilterPref1); when(notificationFilterPreferenceManager.getFilterPreferences(testUser)) .thenReturn(userFilterPreferences); expectedParameters.filterPreferences = Collections.singletonList(userFollowingFilterPref1); notificationParameters = notificationParametersForUser(testUser); this.usersParameterHandler.handleUsersParameter("", notificationParameters); assertEquals(expectedParameters, notificationParameters); userFilterPreferences.add(getFilterPreferenceWithName("currentwiki:XWiki.SomeOther", "")); NotificationFilterPreference userFollowingFilterPref2 = getFilterPreferenceWithName( "currentwiki:XWiki.Bob", "eventUserNotificationFilter"); userFilterPreferences.add(userFollowingFilterPref2); userFilterPreferences.add(getFilterPreference("currentwiki:XWiki.SomeUser4")); expectedParameters.filterPreferences = Arrays.asList(userFollowingFilterPref1, userFollowingFilterPref2); notificationParameters = notificationParametersForUser(testUser); this.usersParameterHandler.handleUsersParameter("", notificationParameters); assertEquals(expectedParameters, notificationParameters); }

Target:
void handlerUsersParameterWhenOnlyTheUserParameterIsGiven() throws NotificationException { final DocumentReference testUser = new DocumentReference("currentwiki", "XWiki", "SomeUser"); NotificationParameters notificationParameters = notificationParametersForUser(testUser); NotificationParameters expectedParameters = notificationParametersForUser(testUser); expectedParameters.filters = Collections.emptyList(); expectedParameters.filterPreferences = Collections.emptyList(); this.usersParameterHandler.handleUsersParameter("", notificationParameters); assertEquals(expectedParameters, notificationParameters); List<NotificationFilterPreference> userFilterPreferences = new ArrayList<>(); userFilterPreferences.add(getFilterPreference("currentwiki:XWiki.SomeUser")); NotificationFilterPreference userFollowingFilterPref1 = getFilterPreferenceWithName( "currentwiki:XWiki.Alice", "eventUserNotificationFilter"); userFilterPreferences.add(userFollowingFilterPref1); when(notificationFilterPreferenceManager.getFilterPreferences(testUser)) .thenReturn(userFilterPreferences); expectedParameters.filterPreferences = Collections.singletonList(userFollowingFilterPref1); notificationParameters = notificationParametersForUser(testUser); this.usersParameterHandler.handleUsersParameter("", notificationParameters); assertEquals(expectedParameters, notificationParameters); userFilterPreferences.add(getFilterPreferenceWithName("currentwiki:XWiki.SomeOther", "")); NotificationFilterPreference userFollowingFilterPref2 = getFilterPreferenceWithName( "currentwiki:XWiki.Bob", "eventUserNotificationFilter"); userFilterPreferences.add(userFollowingFilterPref2); userFilterPreferences.add(getFilterPreference("currentwiki:XWiki.SomeUser4")); expectedParameters.filterPreferences = Arrays.asList(userFollowingFilterPref1, userFollowingFilterPref2); notificationParameters = notificationParametersForUser(testUser); this.usersParameterHandler.handleUsersParameter("", notificationParameters); assertEquals(expectedParameters, notificationParameters); }