CacheRepositoryImpl implements CacheRepository { public Object get(Object key) throws CacheException { try { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Getting object from cache [" + LOGGER.getName() + "] for key [" + key + "]"); } if (key == null) { return null; } else{ ValueWrapper valueWrapper = getCache().get(key); if (valueWrapper == null) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Element for [" + key + "] is null."); } return null; } else { return valueWrapper.get(); } } } catch (Throwable t) { throw new CacheException(t); } }  EhCacheCacheManager getEhCacheCacheManager(); void setEhCacheCacheManager(EhCacheCacheManager ehCacheCacheManager); String getCacheName(); void setCacheName(String cacheName); Object get(Object key); void put(Object key, Object value); void evict(Object key); Object getNativeCache(); long getMemoryUsage(); long getMemoryStoreSize();  }
@Test public void get() { CacheRepository cacheRepository = new CacheRepositoryImpl(); ((CacheRepositoryImpl) cacheRepository).setCacheName(cacheName); ((CacheRepositoryImpl) cacheRepository).setEhCacheCacheManager(ehCacheCacheManager); String keyPut = "keyGet1"; String valPut = "valGet1"; cacheRepository.put(keyPut, valPut); Assert.assertTrue("Same value should be retrieved ", valPut.equals(cacheRepository.get(keyPut))); }