@Test
public void testDestroy01() throws Exception {

    CacheableApplicationContextResolverImpl target = new CacheableApplicationContextResolverImpl();
    final ApplicationContext b000001 = new ClassPathXmlApplicationContext("beansDef/B000001.xml");
    final ApplicationContext b000002 = new ClassPathXmlApplicationContext("beansDef/B000002.xml");
    CacheManager cacheManager = mock(CacheManager.class);
    doReturn(new ArrayList<String>() {
        private static final long serialVersionUID = -6836804456272606019L;
        {
            add(CacheableApplicationContextResolverImpl.BLOGIC_CONTEXT_CACHE_KEY);
        }
    }).when(cacheManager).getCacheNames();
    Cache cache = mock(Cache.class);
    doReturn(new HashMap<String, ApplicationContext>() {
        private static final long serialVersionUID = -8224529649381655075L;
        {
            put("B000001", b000001);
            put("B000002", b000002);
        }
    }).when(cache).getNativeCache();
    doReturn(cache).when(cacheManager).getCache(
            CacheableApplicationContextResolverImpl.BLOGIC_CONTEXT_CACHE_KEY);
    target.cacheManager = cacheManager;
    // テスト実行
    target.destroy();
    verify(cache).clear();
    // 業務コンテキストの全てがクローズ済みであること。
    try {
        b000001.getBean("B000001BLogic");
        fail();
    } catch (IllegalStateException e) {
        assertThat(e.getMessage(), is(
                "BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext"));
    }
    try {
        b000002.getBean("B000002BLogic");
        fail();
    } catch (IllegalStateException e) {
        assertThat(e.getMessage(), is(
                "BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext"));
    }
}