1package org.udger.parser;
5import static org.junit.Assert.*;
12 public void testLRUCacheRespectCapacity()
throws Exception {
13 for(
int i = 0; i < cache.getCapacity() + 1; i++){
16 assertNull(
"Expected the first value put into cache to be absent after adding one more than capacity allows.", cache.get(0));
20 public void testLRUCacheUpdatesLRUOrder()
throws Exception {
21 for(
int i = 0; i < cache.getCapacity(); i++){
24 assertNotNull(
"Expected to first put value to be in the cache.", cache.get(0));
25 cache.put(cache.getCapacity()+1, cache.getCapacity()+1);
26 assertNull(
"Expected the first value to have gone to the tail and second value to be removed for the next.", cache.get(1));