### Question:
DefaultSiteMapExtractor extends SiteMapExtractorBase implements SiteMapConfiguration { @Override public Set<String> getMandatoryCachedPaths() { try (final ResourceResolver resourceResolver = resolverFactory.getServiceResourceResolver()) { final Resource content = resourceResolver.getResource(CONTENT_ROOT); if (isNull(content)) { return Collections.emptySet(); } return StreamSupport.stream(content.getChildren().spliterator(), false) .filter(r -> isPrimaryType(r, SITE_PRIMARY_TYPE)) .map(r -> r.getChild(PAGES)) .filter(this::appliesTo) .map(Resource::getPath) .collect(Collectors.toSet()); } catch (final LoginException e) { return Collections.emptySet(); } }  @Activate void activate(); @Override SiteMapConfiguration getConfiguration(); @Override Pattern getPagePathPattern(); @Override PageRecognizer getPageRecognizer(); @Override UrlExternalizer getUrlExternalizer(); @Override Map<String, String> getXmlNamespaces(); @Override Collection<PropertyProvider> getPropertyProviders(); @Override Set<String> getMandatoryCachedPaths();  }### Answer:
@Test public void getMandatoryCachedPaths() { example.setDomains(); assertEquals(0, model.getMandatoryCachedPaths().size()); example.setDomains(EXAMPLE_COM); Set<String> paths = model.getMandatoryCachedPaths(); assertEquals(1, paths.size()); assertTrue(paths.contains(example.getPages().getPath())); final SiteMock other = repo.init(new SiteMock("other")); paths = model.getMandatoryCachedPaths(); assertEquals(1, paths.size()); assertTrue(paths.contains(example.getPages().getPath())); other.setDomains(EXAMPLE_COM); paths = model.getMandatoryCachedPaths(); assertEquals(2, paths.size()); assertTrue(paths.contains(example.getPages().getPath())); assertTrue(paths.contains(other.getPages().getPath())); }
@SuppressWarnings("unchecked") @Test public void getMandatoryCachedPaths_edgeCases() throws LoginException { final ResourceResolver resolver = repo.getResourceResolver(); when(resolver.getResource(anyString())).thenReturn(null); Set<String> paths = model.getMandatoryCachedPaths(); assertEquals(0, paths.size()); when(resolverFactory.getServiceResourceResolver()).thenThrow(LoginException.class); paths = model.getMandatoryCachedPaths(); assertEquals(0, paths.size()); }