### Question:
JmxSupport implements CacheLifeCycleListener, CacheManagerLifeCycleListener { @Override public void managerDestroyed(CacheManager m) { if (MANAGEMENT_UNAVAILABLE) { return; } if (!m.getProperties().containsKey(REGISTERED_FLAG)) { return; } MBeanServer mbs = getPlatformMBeanServer(); String name = managerName(m); try { mbs.unregisterMBean(new ObjectName(name)); } catch (Exception e) { throw new CacheException("Error unregister JMX bean, ObjectName: " + name, e); } }  @Override void cacheCreated(Cache c, Cache2kConfiguration cfg); @Override void cacheDestroyed(Cache c); @Override void managerCreated(CacheManager m); @Override void managerDestroyed(CacheManager m);  }### Answer:
@Test(expected = InstanceNotFoundException.class) public void testManagerDestroyed() throws Exception { String name = getClass().getName() + ".testManagerDestroyed"; CacheManager m = CacheManager.getInstance(name); MBeanInfo i = getCacheManagerInfo(name); assertEquals(ManagerMXBeanImpl.class.getName(), i.getClassName()); m.close(); getCacheManagerInfo(name); }