UniversalDiscCache implements Cache { @Override public void put(String key, Entry entry) { if (key == null) { return; } FileOutputStream fos = null; try { File file = this.delegate.get(key); fos = new FileOutputStream(file); CacheHeader header = new CacheHeader(key, entry); header.writeHeader(fos); fos.write(entry.data); this.delegate.put(key, file); return; } catch (IOException e) { Log.e(TAG, "fail to put :" + key, e); } finally { IoUtils.closeQuietly(fos); } } UniversalDiscCache(DiscCacheAware delegate); @Override void clear(); @Override Entry get(String key); @Override void put(String key, Entry entry); @Override void initialize(); @Override void invalidate(String key, boolean arg1); @Override void remove(String key);  }
@Test public void testKeyIsNullWhenCalledPut() { Entry entry = new Entry(); discCache.put(null, entry); verify(delegate, never()).put(null, new File("")); }