### Question:
DiskBasedCache implements Cache { @Override public synchronized void invalidate(String key, boolean fullExpire) { Entry entry = get(key); if (entry != null) { entry.softTtl = 0; if (fullExpire) { entry.ttl = 0; } put(key, entry); } } DiskBasedCache(File rootDirectory, int maxCacheSizeInBytes);  DiskBasedCache(File rootDirectory); @Override synchronized void clear(); @Override synchronized Entry get(String key); @Override synchronized void initialize(); @Override synchronized void invalidate(String key, boolean fullExpire); @Override synchronized void put(String key, Entry entry); @Override synchronized void remove(String key); File getFileForKey(String key);  }### Answer:
@Test public void testInvalidate() { Cache.Entry entry = randomData(32); entry.softTtl = 8765432L; entry.ttl = 9876543L; cache.put("key", entry); cache.invalidate("key", false); entry.softTtl = 0; assertThatEntriesAreEqual(cache.get("key"), entry); }