Search in sources :

Example 31 with NotificationPreference

use of org.xwiki.notifications.preferences.NotificationPreference in project xwiki-platform by xwiki.

the class ScopeNotificationFilterTest method matchPreferenceWithIncorrectPreference.

@Test
public void matchPreferenceWithIncorrectPreference() throws Exception {
    NotificationPreference preference = mock(NotificationPreference.class);
    when(preference.getCategory()).thenReturn(NotificationPreferenceCategory.SYSTEM);
    assertFalse(mocker.getComponentUnderTest().matchesPreference(preference));
}
Also used : NotificationPreference(org.xwiki.notifications.preferences.NotificationPreference) Test(org.junit.Test)

Example 32 with NotificationPreference

use of org.xwiki.notifications.preferences.NotificationPreference in project xwiki-platform by xwiki.

the class EventUserFilterTest method generateFilterExpressionWithPreferences.

@Test
public void generateFilterExpressionWithPreferences() throws Exception {
    // Preferences
    mockPreferences();
    NotificationPreference notificationPreference = mock(NotificationPreference.class);
    when(notificationPreference.getFormat()).thenReturn(NotificationFormat.ALERT);
    // Test
    assertNull(mocker.getComponentUnderTest().filterExpression(CURRENT_USER, notificationPreference));
}
Also used : NotificationPreference(org.xwiki.notifications.preferences.NotificationPreference) Test(org.junit.Test)

Aggregations

NotificationPreference (org.xwiki.notifications.preferences.NotificationPreference)32 Test (org.junit.Test)18 DocumentReference (org.xwiki.model.reference.DocumentReference)12 HashMap (java.util.HashMap)8 List (java.util.List)8 NotificationPreferenceProperty (org.xwiki.notifications.preferences.NotificationPreferenceProperty)8 Date (java.util.Date)7 ArrayList (java.util.ArrayList)6 WikiReference (org.xwiki.model.reference.WikiReference)5 NotificationException (org.xwiki.notifications.NotificationException)4 NotificationFormat (org.xwiki.notifications.NotificationFormat)4 NotificationFilterPreference (org.xwiki.notifications.filters.NotificationFilterPreference)4 TargetableNotificationPreference (org.xwiki.notifications.preferences.TargetableNotificationPreference)4 Map (java.util.Map)3 NotificationFilter (org.xwiki.notifications.filters.NotificationFilter)3 NotificationPreferenceManager (org.xwiki.notifications.preferences.NotificationPreferenceManager)3 Query (org.xwiki.query.Query)3 XWiki (com.xpn.xwiki.XWiki)2 XWikiContext (com.xpn.xwiki.XWikiContext)2 XWikiException (com.xpn.xwiki.XWikiException)2