@Test public void testInvalidateSingleton() { CacheService cs = getCache(); cs.longSingletonToCache_5("static"); cs.__cacheData() .invalidateCache(MethodCall.get(cs.getClass(), "longSingletonToCache_5", "static")); int prev = cs.getCounter(); cs.longSingletonToCache_5("static"); assertTrue(prev + 1 == cs.getCounter()); }
@Test public void testInvalidateAllValues() { CacheService cs = getCache(); cs.longServiceToCache_5("static1"); cs.longServiceToCache_5("static2"); cs.longServiceToCache_5("static3"); cs.longServiceToCache_5("static4"); cs.__cacheData() .invalidateCache( MethodCall.get(cs.getClass(), "longServiceToCache_5", "static").getMethod()); int prev = cs.getCounter(); cs.longServiceToCache_5("static1"); cs.longServiceToCache_5("static2"); cs.longServiceToCache_5("static3"); cs.longServiceToCache_5("static4"); assertTrue(prev + 4 == cs.getCounter()); }