### Question:
DefaultNotificationFilterManager implements NotificationFilterManager { @Override public Collection<NotificationFilter> getAllFilters(boolean allWikis) throws NotificationException { if (allWikis) { String currentWikiId = wikiDescriptorManager.getCurrentWikiId(); Map<String, NotificationFilter> filters = new HashMap<>(); try { for (String wikiId : wikiDescriptorManager.getAllIds()) { modelContext.setCurrentEntityReference(new WikiReference(wikiId)); filters.putAll(componentManager.getInstanceMap(NotificationFilter.class)); } } catch (Exception e) { throw new NotificationException(ERROR_MESSAGE, e); } finally { modelContext.setCurrentEntityReference(new WikiReference(currentWikiId)); } return new HashSet<>(filters.values()); } else { try { return new HashSet<>(componentManager.getInstanceList(NotificationFilter.class)); } catch (Exception e) { throw new NotificationException(ERROR_MESSAGE, e); } } }  @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 getAllNotificationsFiltersWithSubWiki() throws Exception { NotificationFilter fakeFilter1 = mock(NotificationFilter.class); NotificationFilter fakeFilter2 = mock(NotificationFilter.class); when(wikiDescriptorManager.getMainWikiId()).thenReturn("somethingElseThanwiki"); when(componentManager.getInstanceList(NotificationFilter.class)) .thenReturn(Arrays.asList(fakeFilter1, fakeFilter2)); Collection<NotificationFilter> filters = mocker.getComponentUnderTest().getAllFilters(testUser, false); assertEquals(2, filters.size()); assertTrue(filters.contains(fakeFilter1)); assertTrue(filters.contains(fakeFilter2)); }
@Test public void getAllFiltersWithMainWiki() throws Exception { NotificationFilter fakeFilter1 = mock(NotificationFilter.class); when(componentManager.getInstanceMap(NotificationFilter.class)) .thenReturn(Collections.singletonMap("1", fakeFilter1)); Collection<NotificationFilter> filters = mocker.getComponentUnderTest().getAllFilters(testUser, false); assertEquals(1, filters.size()); assertTrue(filters.contains(fakeFilter1)); }