mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
change test and fix Spring bug
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package cn.hutool.cache.test;
|
||||
package cn.hutool.cache;
|
||||
|
||||
import cn.hutool.cache.Cache;
|
||||
import cn.hutool.cache.impl.FIFOCache;
|
||||
import cn.hutool.cache.impl.LRUCache;
|
||||
import cn.hutool.cache.impl.WeakCache;
|
@@ -1,10 +1,9 @@
|
||||
package cn.hutool.cache.test;
|
||||
package cn.hutool.cache;
|
||||
|
||||
import cn.hutool.cache.Cache;
|
||||
import cn.hutool.cache.CacheUtil;
|
||||
import cn.hutool.cache.impl.TimedCache;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -34,6 +33,15 @@ public class CacheTest {
|
||||
Assert.assertNull(value1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void fifoCacheCapacityTest(){
|
||||
Cache<String,String> fifoCache = CacheUtil.newFIFOCache(100);
|
||||
for (int i = 0; i < RandomUtil.randomInt(100, 1000); i++) {
|
||||
fifoCache.put("key" + i, "value" + i);
|
||||
}
|
||||
Assert.assertEquals(100, fifoCache.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lfuCacheTest(){
|
||||
Cache<String, String> lfuCache = CacheUtil.newLFUCache(3);
|
@@ -1,4 +1,4 @@
|
||||
package cn.hutool.cache.test;
|
||||
package cn.hutool.cache;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
Reference in New Issue
Block a user