### Question:
ExpiringCacheBase implements ICache<T> { @Override public void flush() { synchronized (cache) { cache.clear(); } }  @Override T get(String key); @Override void put(String key, T value); @Override void flush();  }### Answer:
@Test public void flush() { ExpiringCacheBase<Set<String>> tested = new ExpiringCacheBase<Set<String>>() { }; tested.ttl = 50000; Set<String> value = new HashSet<String>(); Set<String> value2 = new HashSet<String>(); Set<String> value3 = new HashSet<String>(); String key = "a"; String key2_1 = "aaa"; String key2_2 = "aaa"; String key3_1 = "aaa|zzzzz"; String key3_2 = "aaa|zzzzz"; tested.put(key, value); tested.put(key2_1, value2); tested.put(key3_1, value3); Assert.assertEquals(value, tested.get(key)); Assert.assertEquals(value2, tested.get(key2_1)); Assert.assertEquals(value2, tested.get(key2_2)); Assert.assertEquals(value3, tested.get(key3_1)); Assert.assertEquals(value3, tested.get(key3_2)); tested.flush(); Assert.assertNull(tested.get(key)); Assert.assertNull(tested.get(key2_1)); Assert.assertNull(tested.get(key2_2)); Assert.assertNull(tested.get(key3_1)); Assert.assertNull(tested.get(key3_2)); }