### Question:
DefaultNotificationFilterManager implements NotificationFilterManager { @Override public Stream<NotificationFilter> getFiltersRelatedToNotificationPreference(Collection<NotificationFilter> filters, NotificationPreference preference) { return filters.stream().filter(filter -> filter.matchesPreference(preference)); }  @Override Collection<NotificationFilter> getAllFilters(boolean allWikis); @Override Collection<NotificationFilter> getAllFilters(DocumentReference user, boolean onlyEnabled); @Override Stream<NotificationFilter> getFiltersRelatedToNotificationPreference(Collection<NotificationFilter> filters,
            NotificationPreference preference); @Override Stream<NotificationFilter> getToggleableFilters(Collection<NotificationFilter> filters); @Override Map<String, Boolean> getToggeableFilterActivations(DocumentReference user); @Override Stream<NotificationFilter> getEnabledFilters(Collection<NotificationFilter> filters,
            Map<String, Boolean> filterActivations); @Override Block displayFilter(NotificationFilter filter, NotificationFilterPreference preference);  }### Answer:
@Test public void getFiltersWithMatchingFilters() throws Exception { NotificationFilter fakeFilter1 = mock(NotificationFilter.class); NotificationPreference preference = mock(NotificationPreference.class); when(fakeFilter1.matchesPreference(preference)).thenReturn(true); Collection<NotificationFilter> filters = mocker.getComponentUnderTest().getFiltersRelatedToNotificationPreference( Arrays.asList(fakeFilter1), preference).collect(Collectors.toList()); assertEquals(1, filters.size()); assertTrue(filters.contains(fakeFilter1)); }
@Test public void getFiltersWithOneBadFilter() throws Exception { NotificationFilter fakeFilter1 = mock(NotificationFilter.class); NotificationPreference preference = mock(NotificationPreference.class); when(fakeFilter1.matchesPreference(preference)).thenReturn(false); Collection<NotificationFilter> filters = mocker.getComponentUnderTest() .getFiltersRelatedToNotificationPreference(Arrays.asList(fakeFilter1), preference).collect(Collectors.toList()); assertEquals(0, filters.size()); }