### Question:
SiteMapStructureCacheImpl extends CacheBuilderBase implements SiteMapStructureCache, Callback<String>, SiteMapEntry.Visitor<Resource> { @Override public List<SiteMapEntry> get(final Resource rootPage) { try (final ResourceResolver resourceResolver = getServiceResourceResolver()) { final Resource cache = getCache(resourceResolver, rootPage); if (isNull(cache)) { return null; } return extractEntriesFromChildren(cache); } catch (final LoginException e) { logger.error(COULD_NOT_GET_SERVICE_RESOURCE_RESOLVER, e); return null; } }  @Activate void activate(final SiteMapStructureCacheImplConfig config); @Deactivate void deactivate(); @Override List<SiteMapEntry> get(final Resource rootPage); @Override void call(final String rootPagePath); @Override Resource visit(final String childName, final Map<String, String> properties, final Resource resource); @Override Resource visit(final String propertyName, final String propertyValue, final Resource resource); @Override Resource endVisit(final String mapName, final Resource resource); @Override void addRefreshListener(final RefreshListener listener); @Override void removeRefreshListener(final RefreshListener listener); static final String NN_FIRST_CACHE_NODE; }### Answer:
@SuppressWarnings("rawtypes") @Test public void get_cacheExists() { final ResourceMock _0 = addEntryCache(X, 0); _0.putProperty("_u", 1); _0.putProperty("_w_", 2); _0.putProperty("_abc_z", 3); _0.putProperty(JCR_PRIMARY_TYPE, "per:X"); final ResourceMock child = _0.createChild(Y); child.putProperty(X, false); final List<ResourceMock> items = new ArrayList<>(); items.add(_0); items.add(addEntryCache(X, true)); items.add(addEntryCache(X, X)); final List<SiteMapEntry> entries = model.get(page); assertNotNull(entries); final int size = items.size(); assertEquals(size, entries.size()); for (int i = 0; i < size; i++) { assertEquals(items.get(i).getProperty(X), entries.get(i).getProperty(X)); } final SiteMapEntry entry = entries.get(0); assertNotNull(entry.getProperty("_u")); assertNotNull(entry.getProperty("_w_")); assertNull(entry.getProperty("w:")); assertNotNull(entry.getProperty("abc:z")); assertNull(entry.getProperty(JCR_PRIMARY_TYPE)); final Object map = entry.getProperty(Y); assertNotNull(map); assertTrue(map instanceof Map); assertEquals(child.getProperty(X), ((Map)map).get(X)); }
@Test public void get_catchPersistenceException() throws PersistenceException { repo.mockResourceResolverCreate(); disableCacheResolution(); doThrow(PersistenceException.class).when(resourceResolver).commit(); assertNotNull(model.get(page)); }
@Test public void get_extractorIsNull() { repo.mockResourceResolverCreate(); disableCacheResolution(); when(siteMapExtractorsContainer.findFirstFor(page)).thenReturn(null); assertNull(model.get(page)); }