use of org.xwiki.notifications.filters.expression.EmptyNode in project xwiki-platform by xwiki.
the class QueryGeneratorTest method generateQueryWithNoRelevantFilters.
@Test
public void generateQueryWithNoRelevantFilters() throws Exception {
// Mocks
NotificationFilter notificationFilter1 = mock(NotificationFilter.class);
when(notificationFilterManager.getFilters(any(DocumentReference.class), any(NotificationPreference.class))).thenReturn(Collections.singleton(notificationFilter1));
when(notificationFilter1.filterExpression(any(DocumentReference.class), any(NotificationPreference.class))).thenReturn(new EmptyNode());
when(notificationFilter1.matchesPreference(any(NotificationPreference.class))).thenReturn(true);
// Test
ExpressionNode node = mocker.getComponentUnderTest().generateQueryExpression(new DocumentReference("xwiki", "XWiki", "UserA"), NotificationFormat.ALERT, null, startDate, Arrays.asList("event1", "event2"));
assertEquals("(((DATE >= \"Thu Jan 01 01:00:00 CET 1970\" " + "AND (TYPE = \"create\" AND DATE >= \"Fri Jan 02 04:46:40 CET 1970\")) " + "AND NOT (ID IN (\"event1\", \"event2\"))) " + "AND HIDDEN <> true) " + "ORDER BY DATE DESC", node.toString());
}
Aggregations