@Test public void generateQueryWithPreFilteringOnlyUser() throws Exception { NotificationFilter notificationFilter1 = mock(NotificationFilter.class); when(notificationFilter1.filterExpression(any(DocumentReference.class), any(Collection.class), any(NotificationPreference.class))).thenReturn(new ForUserNode(USER_REFERENCE, null)); when(notificationFilter1.matchesPreference(any(NotificationPreference.class))).thenReturn(true); when(this.notificationFilterManager.getFiltersRelatedToNotificationPreference(anyCollection(), any(NotificationPreference.class))) .thenAnswer(invocationOnMock -> ((Collection) invocationOnMock.getArgument(0)).stream()); NotificationParameters parameters = new NotificationParameters(); parameters.user = USER_REFERENCE; parameters.format = NotificationFormat.ALERT; parameters.fromDate = startDate; parameters.filters = Arrays.asList(notificationFilter1); parameters.preferences = Arrays.asList(pref1); parameters.filterPreferences = Arrays.asList(fakeFilterPreference); SimpleEventQuery query = this.generator.generateQuery(parameters); Iterator<QueryCondition> conditions = query.getConditions().iterator(); assertEquals(new CompareQueryCondition(Event.FIELD_DATE, this.startDate, CompareType.GREATER_OR_EQUALS, false), conditions.next()); assertEquals(new CompareQueryCondition(Event.FIELD_TYPE, "create", CompareType.EQUALS, false), conditions.next()); assertEquals( new CompareQueryCondition(Event.FIELD_DATE, this.pref1StartDate, CompareType.GREATER_OR_EQUALS, false), conditions.next()); assertEquals(new StatusQueryCondition(USER_REFERENCE.toString(), null, false), conditions.next()); assertEquals(new CompareQueryCondition(Event.FIELD_HIDDEN, true, CompareType.EQUALS, true), conditions.next()); List<SortClause> sortClause = query.getSorts(); assertEquals(new SortClause(Event.FIELD_DATE, Order.DESC), sortClause.get(0)); }
public SimpleEventQuery generateQuery(NotificationParameters parameters) throws EventStreamException { return this.eventQueryConverter.parse(this.expressionGenerator.generateQueryExpression(parameters)); }
EventQueryGenerator { public SimpleEventQuery generateQuery(NotificationParameters parameters) throws EventStreamException { return this.eventQueryConverter.parse(this.expressionGenerator.generateQueryExpression(parameters)); } }
EventQueryGenerator { public SimpleEventQuery generateQuery(NotificationParameters parameters) throws EventStreamException { return this.eventQueryConverter.parse(this.expressionGenerator.generateQueryExpression(parameters)); }  }
EventQueryGenerator { public SimpleEventQuery generateQuery(NotificationParameters parameters) throws EventStreamException { return this.eventQueryConverter.parse(this.expressionGenerator.generateQueryExpression(parameters)); }  SimpleEventQuery generateQuery(NotificationParameters parameters); }
EventQueryGenerator { public SimpleEventQuery generateQuery(NotificationParameters parameters) throws EventStreamException { return this.eventQueryConverter.parse(this.expressionGenerator.generateQueryExpression(parameters)); }  SimpleEventQuery generateQuery(NotificationParameters parameters);  }