1 5 package com.opensymphony.oscache.base.algorithm; 6 7 import junit.framework.Test; 8 import junit.framework.TestSuite; 9 10 20 public final class TestLRUCache extends TestQueueCache { 21 24 private static LRUCache cache = null; 25 26 31 public TestLRUCache(String str) { 32 super(str); 33 } 34 35 40 public static Test suite() { 41 return new TestSuite(TestLRUCache.class); 42 } 43 44 49 public AbstractConcurrentReadCache getCache() { 50 return cache; 51 } 52 53 57 public void setUp() { 58 if (cache == null) { 60 cache = new LRUCache(); 61 assertNotNull(cache); 62 } 63 } 64 65 68 public void testRemoveItem() { 69 cache.itemPut(KEY); 71 cache.itemPut(KEY + 1); 72 cache.itemPut(KEY + 2); 73 74 cache.itemRetrieved(KEY); 76 77 assertTrue((KEY + 1).equals(cache.removeItem())); 79 } 80 } 81 | Popular Tags |