Created
January 12, 2015 20:36
Revisions
-
pandey-adarsh147 created this gist
Jan 12, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ package com.verctordirection.test; import com.vectordirection.LRUCache; import org.junit.Test; /** * Created by adarshpandey on 1/13/15. */ public class CachingTest { @Test public void testLRU() { System.out.println("========================================="); System.out.println("*********** Caching Test Start **********"); System.out.println("========================================="); LRUCache<Integer, Store> storeLRUCache = new LRUCache<>(3); storeLRUCache.add(new Store(1, 22)); storeLRUCache.add(new Store(2, 23)); storeLRUCache.add(new Store(3, 27)); storeLRUCache.add(new Store(4, 29)); storeLRUCache.add(new Store(5, 28)); storeLRUCache.add(new Store(6, 21)); storeLRUCache.add(new Store(7, 24)); try { Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } assert storeLRUCache.size() == 3; assert storeLRUCache.getValue(1) == null; assert storeLRUCache.getValue(7).getValue() == 24; storeLRUCache.shutdown(); } }