@Test void watchWhenExclusiveFilter() throws Exception { WatchedEntityReference watchedEntityReference = mock(WatchedEntityReference.class); DocumentReference user = new DocumentReference("xwiki", "XWiki", "User"); DefaultNotificationFilterPreference pref1 = new DefaultNotificationFilterPreference(); pref1.setNotificationFormats(Sets.newSet(NotificationFormat.ALERT, NotificationFormat.EMAIL)); when(watchedEntityReference.matchExactly(pref1)).thenReturn(true); pref1.setFilterType(NotificationFilterType.EXCLUSIVE); pref1.setEnabled(true); pref1.setId("pref1"); when(notificationFilterPreferenceManager.getFilterPreferences(user)).thenReturn(Sets.newSet(pref1)); when(watchedEntityReference.isWatchedWithAllEventTypes(user)).thenReturn(false, true); watchedEntitiesManager.watchEntity(watchedEntityReference, user); verify(notificationFilterPreferenceManager).deleteFilterPreference(user, "pref1"); verify(watchedEntityReference, never()).createInclusiveFilterPreference(); verify(this.xwikiEventTypesEnabler).ensureXWikiNotificationsAreEnabled(user); }
@Override public void watchEntity(WatchedEntityReference entity, DocumentReference user) throws NotificationException { handleEntity(entity, user, true); }
DefaultWatchedEntitiesManager implements WatchedEntitiesManager { @Override public void watchEntity(WatchedEntityReference entity, DocumentReference user) throws NotificationException { handleEntity(entity, user, true); } }
DefaultWatchedEntitiesManager implements WatchedEntitiesManager { @Override public void watchEntity(WatchedEntityReference entity, DocumentReference user) throws NotificationException { handleEntity(entity, user, true); }  }
DefaultWatchedEntitiesManager implements WatchedEntitiesManager { @Override public void watchEntity(WatchedEntityReference entity, DocumentReference user) throws NotificationException { handleEntity(entity, user, true); }  @Override void watchEntity(WatchedEntityReference entity, DocumentReference user); @Override void unwatchEntity(WatchedEntityReference entity, DocumentReference user); @Override Collection<String> getWatchedUsers(DocumentReference user); }
DefaultWatchedEntitiesManager implements WatchedEntitiesManager { @Override public void watchEntity(WatchedEntityReference entity, DocumentReference user) throws NotificationException { handleEntity(entity, user, true); }  @Override void watchEntity(WatchedEntityReference entity, DocumentReference user); @Override void unwatchEntity(WatchedEntityReference entity, DocumentReference user); @Override Collection<String> getWatchedUsers(DocumentReference user);  }