@Test public void testMaxSize(){
SessionAwareCache<PreparedPlan> cache = new SessionAwareCache<PreparedPlan>(100);
helpPutPreparedPlans(cache, token, 0, 101);
//the first one should be gone because the max size is 100
assertNull(cache.get(new CacheID(token, pi, EXAMPLE_QUERY + 0)));
assertNotNull(cache.get(new CacheID(token, pi, EXAMPLE_QUERY + 12)));
helpPutPreparedPlans(cache, token, 102, 50);
//"sql12" should still be there based on lru policy
assertNotNull(cache.get(new CacheID(token, pi, EXAMPLE_QUERY + 12)));
helpPutPreparedPlans(cache, token2, 0, 121);
helpPutPreparedPlans(cache, token, 0, 50);
assertTrue(cache.getTotalCacheEntries() <= 100);
}