@Test
public void testClearCache() {

	CacheConfiguration ehConfig = new CacheConfiguration()
			.name(CACHE_NAME)
			.memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LRU)
			.persistence(new PersistenceConfiguration()
					.strategy(PersistenceConfiguration.Strategy.LOCALTEMPSWAP))
			.timeToLiveSeconds(1000)
			.timeToIdleSeconds(1000)
			.clearOnFlush(true);
	Configuration managerConfig = new Configuration()
			.diskStore(new DiskStoreConfiguration().path(CACHE_LOCATION))
			.maxBytesLocalHeap(1, MemoryUnit.MEGABYTES)
			.maxBytesLocalDisk(100, MemoryUnit.MEGABYTES)
			.dynamicConfig(false)
			.cache(ehConfig);
	CacheManager cacheManager = CacheManager.create(managerConfig);
	Ehcache ehcache = cacheManager.getEhcache(CACHE_NAME);
	for (int i = 0; i < 100; i++) {
		Element e = new Element(i, "value" + i);
		ehcache.put(e);
	}
	assertThat(ehcache.getSize(), is(equalTo(100)));
	CacheResource instance = new CacheResource();
	boolean cleared = instance.clearCache();
	assertThat(cleared, is(equalTo(true)));
	assertThat(ehcache.getSize(), is(equalTo(0)));
}