@Test
public void testDestroy() throws Exception {

    ReferenceConfigCache cache = ReferenceConfigCache.getCache();
    MockReferenceConfig config = buildMockReferenceConfig("org.apache.dubbo.config.utils.service.FooService", "group1", "1.0.0");
    cache.get(config);
    XxxMockReferenceConfig configCopy = buildXxxMockReferenceConfig("org.apache.dubbo.config.utils.service.XxxService", "group1", "1.0.0");
    cache.get(configCopy);
    assertEquals(2, cache.getReferredReferences().size());
    cache.destroy(config);
    assertTrue(config.isDestroyMethodRun());
    assertEquals(1, cache.getReferredReferences().size());
    cache.destroy(configCopy);
    assertTrue(configCopy.isDestroyMethodRun());
    assertEquals(0, cache.getReferredReferences().size());
}