@Test public void filterEvent() throws Exception { assertEquals(NotificationFilter.FilterPolicy.NO_EFFECT, mocker.getComponentUnderTest().filterEvent(nonSystemEvent, randomUser, Collections.emptyList(), NotificationFormat.ALERT)); assertEquals(NotificationFilter.FilterPolicy.FILTER, mocker.getComponentUnderTest().filterEvent(systemEvent, randomUser, Collections.emptyList(), NotificationFormat.ALERT)); }
@Override public FilterPolicy filterEvent(Event event, DocumentReference user, Collection<NotificationFilterPreference> filterPreferences, NotificationFormat format) { return event.getUser() != null && event.getUser().getLocalDocumentReference().equals(SYSTEM_USER) ? FilterPolicy.FILTER : FilterPolicy.NO_EFFECT; }
SystemUserNotificationFilter implements NotificationFilter, ToggleableNotificationFilter { @Override public FilterPolicy filterEvent(Event event, DocumentReference user, Collection<NotificationFilterPreference> filterPreferences, NotificationFormat format) { return event.getUser() != null && event.getUser().getLocalDocumentReference().equals(SYSTEM_USER) ? FilterPolicy.FILTER : FilterPolicy.NO_EFFECT; } }
SystemUserNotificationFilter implements NotificationFilter, ToggleableNotificationFilter { @Override public FilterPolicy filterEvent(Event event, DocumentReference user, Collection<NotificationFilterPreference> filterPreferences, NotificationFormat format) { return event.getUser() != null && event.getUser().getLocalDocumentReference().equals(SYSTEM_USER) ? FilterPolicy.FILTER : FilterPolicy.NO_EFFECT; }  }
SystemUserNotificationFilter implements NotificationFilter, ToggleableNotificationFilter { @Override public FilterPolicy filterEvent(Event event, DocumentReference user, Collection<NotificationFilterPreference> filterPreferences, NotificationFormat format) { return event.getUser() != null && event.getUser().getLocalDocumentReference().equals(SYSTEM_USER) ? FilterPolicy.FILTER : FilterPolicy.NO_EFFECT; }  @Override FilterPolicy filterEvent(Event event, DocumentReference user,
            Collection<NotificationFilterPreference> filterPreferences, NotificationFormat format); @Override boolean matchesPreference(NotificationPreference preference); @Override ExpressionNode filterExpression(DocumentReference user,
            Collection<NotificationFilterPreference> filterPreferences, NotificationPreference preference); @Override ExpressionNode filterExpression(DocumentReference user,
            Collection<NotificationFilterPreference> filterPreferences,
            NotificationFilterType type, NotificationFormat format); @Override String getName(); }
SystemUserNotificationFilter implements NotificationFilter, ToggleableNotificationFilter { @Override public FilterPolicy filterEvent(Event event, DocumentReference user, Collection<NotificationFilterPreference> filterPreferences, NotificationFormat format) { return event.getUser() != null && event.getUser().getLocalDocumentReference().equals(SYSTEM_USER) ? FilterPolicy.FILTER : FilterPolicy.NO_EFFECT; }  @Override FilterPolicy filterEvent(Event event, DocumentReference user,
            Collection<NotificationFilterPreference> filterPreferences, NotificationFormat format); @Override boolean matchesPreference(NotificationPreference preference); @Override ExpressionNode filterExpression(DocumentReference user,
            Collection<NotificationFilterPreference> filterPreferences, NotificationPreference preference); @Override ExpressionNode filterExpression(DocumentReference user,
            Collection<NotificationFilterPreference> filterPreferences,
            NotificationFilterType type, NotificationFormat format); @Override String getName(); static final String FILTER_NAME; }