public void testBasics() throws CacheAcquireException {
assertEquals("time-limited", TimeLimited.TYPE);
assertEquals("ttl", TimeLimited.PARAM_TTL);
assertEquals(30, TimeLimited.DEFAULT_TTL);
Cache cache = new TimeLimited();
assertTrue(cache instanceof TimeLimited);
assertEquals("time-limited", cache.getType());
assertEquals(30, ((TimeLimited) cache).getTTL());
assertEquals(Cache.DEFAULT_NAME, cache.getName());
Properties params = new Properties();
params.put(Cache.PARAM_NAME, "dummy1");
cache.initialize(params);
assertEquals(30, ((TimeLimited) cache).getTTL());
assertEquals("dummy1", cache.getName());
params.clear();
params.put(Cache.PARAM_NAME, "dummy2");
params.put(TimeLimited.PARAM_TTL, "-10");
cache.initialize(params);
assertEquals(30, ((TimeLimited) cache).getTTL());
assertEquals("dummy2", cache.getName());
params.clear();
params.put(Cache.PARAM_NAME, "dummy3");
params.put(TimeLimited.PARAM_TTL, "0");
cache.initialize(params);
assertEquals(30, ((TimeLimited) cache).getTTL());
assertEquals("dummy3", cache.getName());
params.clear();
params.put(Cache.PARAM_NAME, "dummy4");
params.put(TimeLimited.PARAM_TTL, "10");
cache.initialize(params);
assertEquals(10, ((TimeLimited) cache).getTTL());
assertEquals("dummy4", cache.getName());
assertFalse(cache.containsKey("first key"));
assertFalse(cache.containsKey("second key"));
assertNull(cache.put("first key", "first value"));
assertTrue(cache.containsKey("first key"));
assertFalse(cache.containsKey("second key"));
assertNull(cache.put("second key", "second value"));
assertTrue(cache.containsKey("first key"));
assertTrue(cache.containsKey("second key"));
}