@Test public void getEventsCount() throws Exception { Event event1 = createMockedEvent(); Event event2 = createMockedEvent(); Event event3 = createMockedEvent(); when(eventStream.searchEvents(query)).thenReturn( Arrays.asList(event1, event2, event1, event2, event2, event2, event1, event2, event2, event2), Arrays.asList(event1, event2, event2, event1, event3)); when(recordableEventDescriptorHelper.hasDescriptor(isNull(), any(DocumentReference.class))).thenReturn(true); NotificationParameters parameters = new NotificationParameters(); parameters.user = new DocumentReference("xwiki", "XWiki", "UserA"); parameters.expectedCount = 5; long result = this.defaultParametrizedNotificationManager.getEvents(parameters).size(); assertEquals(5, result); verifyZeroInteractions(event3); }
@Override public List<CompositeEvent> getEvents(NotificationParameters parameters) throws NotificationException { if (Boolean.TRUE.equals(parameters.onlyUnread) && !parameters.filters.contains(eventReadAlertFilter)) { parameters.filters.add(eventReadAlertFilter); } if (Boolean.TRUE.equals(parameters.onlyUnread) && !parameters.filters.contains(eventReadEmailFilter)) { parameters.filters.add(eventReadEmailFilter); } return getEvents(new ArrayList<>(), parameters); }
DefaultParametrizedNotificationManager implements ParametrizedNotificationManager { @Override public List<CompositeEvent> getEvents(NotificationParameters parameters) throws NotificationException { if (Boolean.TRUE.equals(parameters.onlyUnread) && !parameters.filters.contains(eventReadAlertFilter)) { parameters.filters.add(eventReadAlertFilter); } if (Boolean.TRUE.equals(parameters.onlyUnread) && !parameters.filters.contains(eventReadEmailFilter)) { parameters.filters.add(eventReadEmailFilter); } return getEvents(new ArrayList<>(), parameters); } }
DefaultParametrizedNotificationManager implements ParametrizedNotificationManager { @Override public List<CompositeEvent> getEvents(NotificationParameters parameters) throws NotificationException { if (Boolean.TRUE.equals(parameters.onlyUnread) && !parameters.filters.contains(eventReadAlertFilter)) { parameters.filters.add(eventReadAlertFilter); } if (Boolean.TRUE.equals(parameters.onlyUnread) && !parameters.filters.contains(eventReadEmailFilter)) { parameters.filters.add(eventReadEmailFilter); } return getEvents(new ArrayList<>(), parameters); }  }
DefaultParametrizedNotificationManager implements ParametrizedNotificationManager { @Override public List<CompositeEvent> getEvents(NotificationParameters parameters) throws NotificationException { if (Boolean.TRUE.equals(parameters.onlyUnread) && !parameters.filters.contains(eventReadAlertFilter)) { parameters.filters.add(eventReadAlertFilter); } if (Boolean.TRUE.equals(parameters.onlyUnread) && !parameters.filters.contains(eventReadEmailFilter)) { parameters.filters.add(eventReadEmailFilter); } return getEvents(new ArrayList<>(), parameters); }  @Override List<CompositeEvent> getEvents(NotificationParameters parameters); }
DefaultParametrizedNotificationManager implements ParametrizedNotificationManager { @Override public List<CompositeEvent> getEvents(NotificationParameters parameters) throws NotificationException { if (Boolean.TRUE.equals(parameters.onlyUnread) && !parameters.filters.contains(eventReadAlertFilter)) { parameters.filters.add(eventReadAlertFilter); } if (Boolean.TRUE.equals(parameters.onlyUnread) && !parameters.filters.contains(eventReadEmailFilter)) { parameters.filters.add(eventReadEmailFilter); } return getEvents(new ArrayList<>(), parameters); }  @Override List<CompositeEvent> getEvents(NotificationParameters parameters);  }