ContentCacheImpl implements ContentCache { @Override public ContentWriter getWriter(final String url) { final File cacheFile = createCacheFile(); ContentWriter writer = new FileContentWriter(cacheFile, url, null); writer.addListener(new ContentStreamListener() { @Override public void contentStreamClosed() throws ContentIOException { recordCacheEntries(url, cacheFile); } }); return writer; }  @Override boolean contains(String contentUrl); boolean contains(Key key); void putIntoLookup(Key key, String value); String getCacheFilePath(String contentUrl); String getContentUrl(File file); @Override ContentReader getReader(String contentUrl); @Override boolean put(String contentUrl, ContentReader source); @Override void remove(String contentUrl); void removeAll(); @Override void deleteFile(String url); @Override ContentWriter getWriter(final String url); static String createNewCacheFilePath(); void setMemoryStore(SimpleCache<Key, String> memoryStore); void setCacheRoot(File cacheRoot); @Override File getCacheRoot(); void processFiles(FileHandler handler);  }
@Test public void getWriter() { final String url = "store: FileContentWriter writer = (FileContentWriter) contentCache.getWriter(url); writer.putContent("Some test content for " + getClass().getName()); assertEquals(url, writer.getContentUrl()); Mockito.verify(lookupTable).put(Key.forUrl(url), writer.getFile().getAbsolutePath()); Mockito.verify(lookupTable).put(Key.forCacheFile(writer.getFile().getAbsolutePath()), url); }