### Question:
EhcacheWebServiceEndpoint { @WebMethod public Statistics getStatistics(String cacheName) throws IllegalStateException { net.sf.ehcache.Cache cache = lookupCache(cacheName); return new Statistics(cache.getStatistics()); }  @WebMethod String ping(); @WebMethod Cache getCache(String cacheName); @WebMethod void addCache(String cacheName); @WebMethod void removeCache(String cacheName); @WebMethod String[] cacheNames(); @WebMethod Status getStatus(String cacheName); @WebMethod void put(String cacheName, Element element); @WebMethod Element get(String cacheName, String key); @WebMethod List getKeys(String cacheName); @WebMethod boolean remove(String cacheName, String key); @WebMethod List getKeysWithExpiryCheck(String cacheName); @WebMethod List getKeysNoDuplicateCheck(String cacheName); @WebMethod Element getQuiet(String cacheName, Object key); @WebMethod void putQuiet(String cacheName, Element element); @WebMethod boolean removeQuiet(String cacheName, String key); @WebMethod void removeAll(String cacheName); @WebMethod int getSize(String cacheName); @WebMethod Statistics getStatistics(String cacheName); @WebMethod StatisticsAccuracy getStatisticsAccuracy(String cacheName); @WebMethod void clearStatistics(String cacheName); @WebMethod void load(String cacheName, String key); @WebMethod void loadAll(String cacheName, Collection<String> keys); @WebMethod HashMap getAllWithLoader(String cacheName, Collection keys); @WebMethod Element getWithLoader(String cacheName, String key);  }### Answer:
@Test public void testGetStatistics() throws NoSuchCacheException_Exception, CacheException_Exception, IllegalStateException_Exception { cacheService.clearStatistics("sampleCache1"); Statistics statistics = cacheService.getStatistics("sampleCache1"); assertEquals(0L, statistics.getCacheHits()); putElementIntoCache(); getElementFromCache(); statistics = cacheService.getStatistics("sampleCache1"); assertEquals(1L, statistics.getCacheHits()); assertTrue(statistics.getAverageGetTime() >= 0); assertEquals(0L, statistics.getEvictionCount()); assertEquals(1L, statistics.getInMemoryHits()); assertEquals(0L, statistics.getOnDiskHits()); assertEquals(StatisticsAccuracy.STATISTICS_ACCURACY_BEST_EFFORT, statistics.getStatisticsAccuracy()); }
@Test public void testGetStatistics() throws Exception { cacheService.clearStatistics("sampleCache1"); Statistics statistics = cacheService.getStatistics("sampleCache1"); assertEquals(0L, statistics.getCacheHits()); putElementIntoCache(); getElementFromCache(); statistics = cacheService.getStatistics("sampleCache1"); assertEquals(1L, statistics.getCacheHits()); assertTrue(statistics.getAverageGetTime() >= 0); assertEquals(0L, statistics.getEvictionCount()); assertEquals(1L, statistics.getInMemoryHits()); assertEquals(0L, statistics.getOnDiskHits()); assertEquals(StatisticsAccuracy.STATISTICS_ACCURACY_BEST_EFFORT, statistics.getStatisticsAccuracy()); }