### Question:
ReferenceConfigCache { public void destroyAll() { Set<String> set = new HashSet<String>(cache.keySet()); for (String key : set) { destroyKey(key); } } private  ReferenceConfigCache(String name, KeyGenerator generator); static ReferenceConfigCache getCache(); static ReferenceConfigCache getCache(String name); static ReferenceConfigCache getCache(String name, KeyGenerator keyGenerator); @SuppressWarnings("unchecked") T get(ReferenceConfig<T> referenceConfig); void destroy(ReferenceConfig<T> referenceConfig); void destroyAll(); @Override String toString(); static final String DEFAULT_NAME; static final KeyGenerator DEFAULT_KEY_GENERATOR; }### Answer:
@Test public void testDestroyAll() throws Exception { ReferenceConfigCache cache = ReferenceConfigCache.getCache(); MockReferenceConfig config = buildMockReferenceConfig("FooService", "group1", "1.0.0"); cache.get(config); MockReferenceConfig configCopy = buildMockReferenceConfig("XxxService", "group1", "1.0.0"); cache.get(configCopy); assertEquals(2, cache.cache.size()); cache.destroyAll(); assertTrue(config.isDestroyMethodRun()); assertTrue(configCopy.isDestroyMethodRun()); assertEquals(0, cache.cache.size()); }