### Question:
UpdatingSelfPopulatingCache extends SelfPopulatingCache { public void refresh() throws CacheException { throw new CacheException("UpdatingSelfPopulatingCache objects should not be refreshed."); } UpdatingSelfPopulatingCache(Ehcache cache, final UpdatingCacheEntryFactory factory); Element get(final Object key); void refresh();  }### Answer:
@Test public void testRefresh() throws Exception { final String value = "value"; final CountingCacheEntryFactory factory = new CountingCacheEntryFactory(value); selfPopulatingCache = new UpdatingSelfPopulatingCache(cache, factory); try { selfPopulatingCache.refresh(); fail(); } catch (CacheException e) { assertEquals("UpdatingSelfPopulatingCache objects should not be refreshed.", e.getMessage()); } }
@Test public void testRefresh() throws Exception { final String value = "value"; final CountingCacheEntryFactory factory = new CountingCacheEntryFactory(value); UpdatingSelfPopulatingCache selfPopulatingCache = new UpdatingSelfPopulatingCache(cache, factory); try { selfPopulatingCache.refresh(); fail(); } catch (CacheException e) { assertEquals("UpdatingSelfPopulatingCache objects should not be refreshed.", e.getMessage()); } }