@Test(expected = SSMCache.ValueRetrievalException.class) public void getWithValueLoaderShouldWrapException() throws TimeoutException, CacheException { String key = "someCacheKey"; when(cache.isEnabled()).thenReturn(false); ssmCache.get(key, new Callable<Object>() { @Override public Object call() throws Exception { throw new Exception("some exception"); } }); }
@Override public ValueWrapper get(final Object key) { if (!cache.isEnabled()) { LOGGER.warn("Cache {} is disabled. Cannot get {} from cache", cache.getName(), key); return null; } Object value = getValue(key); if (value == null) { LOGGER.info("Cache miss. Get by key {} from cache {}", key, cache.getName()); return null; } LOGGER.info("Cache hit. Get by key {} from cache {} value '{}'", new Object[] { key, cache.getName(), value }); return value instanceof PertinentNegativeNull ? new SimpleValueWrapper(null) : new SimpleValueWrapper(value); }
SSMCache implements Cache { @Override public ValueWrapper get(final Object key) { if (!cache.isEnabled()) { LOGGER.warn("Cache {} is disabled. Cannot get {} from cache", cache.getName(), key); return null; } Object value = getValue(key); if (value == null) { LOGGER.info("Cache miss. Get by key {} from cache {}", key, cache.getName()); return null; } LOGGER.info("Cache hit. Get by key {} from cache {} value '{}'", new Object[] { key, cache.getName(), value }); return value instanceof PertinentNegativeNull ? new SimpleValueWrapper(null) : new SimpleValueWrapper(value); } }
SSMCache implements Cache { @Override public ValueWrapper get(final Object key) { if (!cache.isEnabled()) { LOGGER.warn("Cache {} is disabled. Cannot get {} from cache", cache.getName(), key); return null; } Object value = getValue(key); if (value == null) { LOGGER.info("Cache miss. Get by key {} from cache {}", key, cache.getName()); return null; } LOGGER.info("Cache hit. Get by key {} from cache {} value '{}'", new Object[] { key, cache.getName(), value }); return value instanceof PertinentNegativeNull ? new SimpleValueWrapper(null) : new SimpleValueWrapper(value); } SSMCache(final com.google.code.ssm.Cache cache, final int expiration, final boolean allowClear, final boolean registerAliases,
            final boolean muteExceptions);  SSMCache(final com.google.code.ssm.Cache cache, final int expiration, final boolean allowClear);  SSMCache(final com.google.code.ssm.Cache cache, final int expiration);  SSMCache(final SSMCache ssmCache, final int expiration); }
SSMCache implements Cache { @Override public ValueWrapper get(final Object key) { if (!cache.isEnabled()) { LOGGER.warn("Cache {} is disabled. Cannot get {} from cache", cache.getName(), key); return null; } Object value = getValue(key); if (value == null) { LOGGER.info("Cache miss. Get by key {} from cache {}", key, cache.getName()); return null; } LOGGER.info("Cache hit. Get by key {} from cache {} value '{}'", new Object[] { key, cache.getName(), value }); return value instanceof PertinentNegativeNull ? new SimpleValueWrapper(null) : new SimpleValueWrapper(value); } SSMCache(final com.google.code.ssm.Cache cache, final int expiration, final boolean allowClear, final boolean registerAliases,
            final boolean muteExceptions);  SSMCache(final com.google.code.ssm.Cache cache, final int expiration, final boolean allowClear);  SSMCache(final com.google.code.ssm.Cache cache, final int expiration);  SSMCache(final SSMCache ssmCache, final int expiration); @Override String getName(); @Override Object getNativeCache(); @Override ValueWrapper get(final Object key); @Override @SuppressWarnings("unchecked") T get(final Object key, final Class<T> type); @Override @SuppressWarnings("unchecked") T get(final Object key, final Callable<T> valueLoader); @Override void put(final Object key, final Object value); @Override ValueWrapper putIfAbsent(final Object key, final Object value); @Override void evict(final Object key); @Override void clear(); }
SSMCache implements Cache { @Override public ValueWrapper get(final Object key) { if (!cache.isEnabled()) { LOGGER.warn("Cache {} is disabled. Cannot get {} from cache", cache.getName(), key); return null; } Object value = getValue(key); if (value == null) { LOGGER.info("Cache miss. Get by key {} from cache {}", key, cache.getName()); return null; } LOGGER.info("Cache hit. Get by key {} from cache {} value '{}'", new Object[] { key, cache.getName(), value }); return value instanceof PertinentNegativeNull ? new SimpleValueWrapper(null) : new SimpleValueWrapper(value); } SSMCache(final com.google.code.ssm.Cache cache, final int expiration, final boolean allowClear, final boolean registerAliases,
            final boolean muteExceptions);  SSMCache(final com.google.code.ssm.Cache cache, final int expiration, final boolean allowClear);  SSMCache(final com.google.code.ssm.Cache cache, final int expiration);  SSMCache(final SSMCache ssmCache, final int expiration); @Override String getName(); @Override Object getNativeCache(); @Override ValueWrapper get(final Object key); @Override @SuppressWarnings("unchecked") T get(final Object key, final Class<T> type); @Override @SuppressWarnings("unchecked") T get(final Object key, final Callable<T> valueLoader); @Override void put(final Object key, final Object value); @Override ValueWrapper putIfAbsent(final Object key, final Object value); @Override void evict(final Object key); @Override void clear();  }