OntologyCacheImpl implements OntologyCache { @Override public void clearCache(@Nonnull Resource recordId) { getOntologyCache().ifPresent(cache -> { for (Cache.Entry<String, Ontology> entry : cache) { if (entry.getKey().startsWith(recordId.stringValue())) { cache.remove(entry.getKey()); } } }); }  @Reference void setCacheManager(CacheManager cacheManager); @Override String generateKey(String recordIri, String commitIri); @Override Optional<Cache<String, Ontology>> getOntologyCache(); @Override void clearCacheImports(Resource ontologyIRI); @Override void clearCache(@Nonnull Resource recordId); @Override void removeFromCache(String recordIdStr, String commitIdStr);  }
@Test public void clearCacheAndHitTest() throws Exception { service.clearCache(recordId); verify(cache).remove(key); }
@Test public void clearCacheAndMissTest() throws Exception { service.clearCache(vf.createIRI("http: verify(cache, times(0)).remove(anyString()); }