1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 17:49:38 +02:00
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@6331 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Alex Wenckus 2006-12-07 03:25:39 +00:00 committed by alex
parent 5273e6c73d
commit f40cb8bfbf
2 changed files with 94 additions and 43 deletions

View file

@ -60,18 +60,19 @@ import junit.framework.TestCase;
public class CacheTest extends TestCase {
public void testMaxSize() {
Cache cache = new Cache(100, -1);
for (int i=0; i<1000; i++) {
cache.put(new Integer(i), "value");
Cache<Integer, String> cache = new Cache<Integer, String>(100, -1);
for (int i=0; i < 1000; i++) {
cache.put(i, "value");
assertTrue("Cache size must never be larger than 100.", cache.size() <= 100);
}
}
public void testLRU() {
Cache cache = new Cache(100, -1);
for (int i=0; i<1000; i++) {
cache.put(new Integer(i), "value");
assertTrue("LRU algorithm for cache key of '0' failed.", cache.get(new Integer(0)) != null);
Cache<Integer, String> cache = new Cache<Integer, String>(100, -1);
for (int i=0; i < 1000; i++) {
cache.put(i, "value");
assertTrue("LRU algorithm for cache key of '0' failed.",
cache.get(new Integer(0)) != null);
}
}
}