public void testDestroyCacheManager() throws Exception {
setUpAlternativeConfigurationProperties();
cacheManagerFactoryBean.createCacheManager();
GeneralCacheAdministrator cacheManager = getCacheManager();
String key = "jedi";
String entry = "Anakin";
cacheManager.putInCache(key, entry);
assertSame(entry, cacheManager.getFromCache(key));
cacheManagerFactoryBean.destroyCacheManager();
try {
cacheManager.getFromCache(key);
fail("There should not be any cache elements");
} catch (NeedsRefreshException needsRefreshException) {
// we are expecting this exception.
}