public void testBasics() throws CacheAcquireException {
assertEquals("count-limited", CountLimited.TYPE);
assertEquals("capacity", CountLimited.PARAM_CAPACITY);
assertEquals(30, CountLimited.DEFAULT_CAPACITY);
Cache cache = new CountLimited();
assertTrue(cache instanceof CountLimited);
assertEquals("count-limited", cache.getType());
assertEquals(30, ((CountLimited) cache).getCapacity());
assertEquals(Cache.DEFAULT_NAME, cache.getName());
Properties params = new Properties();
params.put(Cache.PARAM_NAME, "dummy1");
cache.initialize(params);
assertEquals(30, ((CountLimited) cache).getCapacity());
assertEquals("dummy1", cache.getName());
params.clear();
params.put(Cache.PARAM_NAME, "dummy2");
params.put(CountLimited.PARAM_CAPACITY, "-10");
cache.initialize(params);
assertEquals(30, ((CountLimited) cache).getCapacity());
assertEquals("dummy2", cache.getName());
params.clear();
params.put(Cache.PARAM_NAME, "dummy3");
params.put(CountLimited.PARAM_CAPACITY, "0");
cache.initialize(params);
assertEquals(30, ((CountLimited) cache).getCapacity());
assertEquals("dummy3", cache.getName());
params.clear();
params.put(Cache.PARAM_NAME, "dummy4");
params.put(CountLimited.PARAM_CAPACITY, "10");
cache.initialize(params);
assertEquals(10, ((CountLimited) cache).getCapacity());
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"));
}