DiskbackedCache implements CacheStrategy<CacheKey, CacheValue>, Closeable { @Override public void destroy() { try { if (dbConnection != null) { dbConnection.createStatement().execute(SQL_SHUTDOWN); dbConnection.close(); } } catch (SQLException e) { throw new WroRuntimeException("Database is already closed", e); } finally { defaultCache.destroy(); this.destroyed = true; } } DiskbackedCache(int lruSize, String dbPathString);   DiskbackedCache(int lruSize); @Override void put(CacheKey key, CacheValue value); @Override CacheValue get(CacheKey key); @Override void clear(); @Override void destroy(); @Override void close(); static final String NAME; static final String DB_PROP_KEY; static final String SQL_PUT_CACHE_VALUE; static final String SQL_GET_QUERY; }
@Test(expected = ro.isdc.wro.WroRuntimeException.class) public void testDestroy() throws Exception { CacheKey key = new CacheKey("groupName", ResourceType.CSS); CacheValue value = CacheValue.valueOf("rawContent", "hash"); DiskbackedCache cache = new DiskbackedCache(100); cache.put(key, value); cache.destroy(); cache.get(key); }