### Question:
CacheBuilderBase implements CacheBuilder { @Override public final void rebuild(final String rootPagePath) { try (final ResourceResolver resourceResolver = getServiceResourceResolver()) { String path = rootPagePath; while (isNotBlank(path)) { if (isCached(resourceResolver, path)) { rebuildImpl(path); } path = substringBeforeLast(path, SLASH); } resourceResolver.commit(); } catch (final LoginException e) { logger.error(COULD_NOT_GET_SERVICE_RESOURCE_RESOLVER, e); } catch (final PersistenceException e) { logger.error(COULD_NOT_SAVE_CHANGES_TO_REPOSITORY, e); } }  final String getOriginalPath(final String cachePath); @Override final void rebuild(final String rootPagePath); @Override void rebuildAll();  }### Answer:
@Test public void rebuild_cacheIsNull() { model.rebuild(resource.getPath() + SLASH + "not-cached"); verifyCommits(1); assertTrue(rebuildImplCalled.contains(resource.getPath())); assertTrue(rebuildImplCalled.contains(jcrContent.getPath())); assertTrue(rebuildImplCalled.contains(page.getPath())); assertTrue(rebuildImplCalled.contains(parent.getPath())); assertTrue(rebuildImplCalled.contains(contentRoot.getPath())); }
@Test public void rebuild_rootPageIsNull() { disableResolution(resource); model.rebuild(resource.getPath()); verifyCommits(1); assertTrue(rebuildImplCalled.contains(resource.getPath())); assertTrue(rebuildImplCalled.contains(jcrContent.getPath())); assertTrue(rebuildImplCalled.contains(page.getPath())); assertTrue(rebuildImplCalled.contains(parent.getPath())); assertTrue(rebuildImplCalled.contains(contentRoot.getPath())); }
@Test public void rebuild() { model.rebuild(jcrContent.getPath()); verifyCommits(1); assertTrue(rebuildImplCalled.contains(jcrContent.getPath())); assertTrue(rebuildImplCalled.contains(page.getPath())); assertTrue(rebuildImplCalled.contains(parent.getPath())); assertTrue(rebuildImplCalled.contains(contentRoot.getPath())); }