### Question:
JmxSupport implements CacheLifeCycleListener, CacheManagerLifeCycleListener { @Override public void cacheDestroyed(Cache c) { if (MANAGEMENT_UNAVAILABLE) { return; } MBeanServer mbs = getPlatformMBeanServer(); String name = standardName(c.getCacheManager(), c); try { mbs.unregisterMBean(new ObjectName(name)); } catch (InstanceNotFoundException ignore) { } catch (Exception e) { throw new CacheException("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 testCacheDestroyed() throws Exception { String name = getClass().getName() + ".testCacheDestroyed"; Cache c = Cache2kBuilder.of(Object.class, Object.class) .name(name) .eternal(true) .build(); MBeanInfo i = getCacheInfo(name); assertEquals(CacheMXBeanImpl.class.getName(), i.getClassName()); c.close(); getCacheInfo(name); }