assertEquals(cached.get(i),list.getCacheList().get(i));
}
}
public void testRemoves() throws Exception{
ListContainerImpl list=getStoreList("test");
int initialDataSize=10;
List data=getDataList(initialDataSize);
list.addAll(data);
assertEquals(MAX_CACHE_SIZE,list.getCacheList().size());
List cached=getCachedList(MAX_CACHE_SIZE);
list.addAll(cached);
assertEquals(MAX_CACHE_SIZE,list.getCacheList().size());
for(int i=0;i<cached.size();i++){
assertNotSame(cached.get(i),list.getCacheList().get(i));
}
for(int i=0;i<initialDataSize;i++){
list.remove(0);
}
assertEquals(0,list.getCacheList().size());
// repopulate the cache
for(int i=0;i<MAX_CACHE_SIZE;i++){
list.get(i);
}
assertEquals(MAX_CACHE_SIZE,list.getCacheList().size());
for(int i=0;i<cached.size();i++){
assertEquals(cached.get(i),list.getCacheList().get(i));
}
}