return aValue + 10;
}
- private CachedObject<Integer, Integer> createCached(Cache aCache) {
+ private CachedObject<Integer, Integer> createCached(Cache<Integer,Integer> aCache) {
return new CachedObject<Integer, Integer>(aCache, OBJECT_KEY, _computation);
}
*
*/
public void testComputation() {
- CachedObject<Integer, Integer> cached = createCached(new ZeroCache());
+ CachedObject<Integer, Integer> cached = createCached(new ZeroCache<Integer,Integer>());
int value = cached.get();
assertEquals(compute(OBJECT_KEY), value);
assertEquals(1, _ncomputations);
}
public void testInvalidateCache() {
- CachedObject<Integer, Integer> cached = createCached(new ForeverCache());
+ CachedObject<Integer, Integer> cached = createCached(new ForeverCache<Integer,Integer>());
int value = cached.get();
assertEquals(compute(OBJECT_KEY), value);
assertEquals(1, _ncomputations);
}
public void testBehaviorEhCache() throws CacheException, IOException {
- Cache cache = new EhCache(new TestResource(CachedObjectTest.class, EHCACHE_CONFIG), "test");
+ Cache<Integer,Integer> cache = new EhCache<Integer,Integer>(new TestResource(CachedObjectTest.class, EHCACHE_CONFIG), "test");
CachedObject<Integer, Integer> cached = createCached(cache);
assertTrue( cache == cached.getCache());
}
public void testBehaviorEhCacheDefault() throws CacheException, IOException {
- Cache cache = new EhCache(new TestResource(CachedObjectTest.class, EHCACHE_CONFIG), "undefined");
+ Cache<Integer,Integer> cache = new EhCache<Integer,Integer>(new TestResource(CachedObjectTest.class, EHCACHE_CONFIG), "undefined");
CachedObject<Integer, Integer> cached = createCached(cache);
assertTrue( cache == cached.getCache());
public void testBehaviorForeverCache() {
- CachedObject<Integer, Integer> cached = createCached(new ForeverCache());
+ CachedObject<Integer, Integer> cached = createCached(new ForeverCache<Integer,Integer>());
int value = cached.get();
assertEquals(compute(OBJECT_KEY), value);
assertEquals(1, _ncomputations);
}
public void testBehaviorZeroCache() {
- CachedObject<Integer, Integer> cached = createCached(new ZeroCache());
+ CachedObject<Integer, Integer> cached = createCached(new ZeroCache<Integer,Integer>());
int value = cached.get();
assertEquals(compute(OBJECT_KEY), value);
assertEquals(1, _ncomputations);