/** * {@inheritDoc} */ @Override public V get(K key) throws CacheLoadingException { return cache.get(key); }
ehcache.get("foo"); fail(); } catch (IllegalStateException e) {
@Override public V get(K key) { checkClosed(); try { return ehCache.get(key); } catch (CacheLoadingException e) { throw jsr107CacheLoaderException(e); } }
@Test public void getCacheGets() throws Exception { cache.get(1L); assertThat(cacheStatistics.getCacheGets()).isEqualTo(1); }
@Test public void getCacheMisses() throws Exception { cache.get(1L); assertThat(cacheStatistics.getCacheMisses()).isEqualTo(1L); assertStat("Cache:MissCount").isEqualTo(1L); }
@Test public void getExpirations() throws Exception { cache.put(1L, "a"); assertThat(expirations).isEmpty(); timeSource.advanceTime(TIME_TO_EXPIRATION); assertThat(cache.get(1L)).isNull(); assertThat(expirations).hasSize(1); assertThat(expirations.get(0).getKey()).isEqualTo(1L); assertThat(cacheStatistics.getCacheExpirations()).isEqualTo(1L); assertStat("Cache:ExpirationCount").isEqualTo(1L); }
@Test public void getCacheHits() throws Exception { cache.put(1L, "a"); cache.get(1L); assertThat(cacheStatistics.getCacheHits()).isEqualTo(1L); assertStat("Cache:HitCount").isEqualTo(1L); }
@Test public void getCacheMissPercentage() throws Exception { cache.get(1L); assertThat(cacheStatistics.getCacheMissPercentage()).isEqualTo(100.0f); }
@Test public void getCacheHitPercentage() throws Exception { cache.put(1L, "a"); cache.get(1L); assertThat(cacheStatistics.getCacheHitPercentage()).isEqualTo(100.0f); }
/** * {@inheritDoc} */ @Override public V get(K key) throws CacheLoadingException { return cache.get(key); }
@Override public V get(K key) { checkClosed(); try { return ehCache.get(key); } catch (CacheLoadingException e) { throw jsr107CacheLoaderException(e); } }