From 11bf2c37437ace406ea8cad45562de2cf5d2ae01 Mon Sep 17 00:00:00 2001 From: Looly Date: Wed, 30 Mar 2022 11:48:20 +0800 Subject: [PATCH] add test --- .../test/java/cn/hutool/cache/LRUCacheTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hutool-cache/src/test/java/cn/hutool/cache/LRUCacheTest.java b/hutool-cache/src/test/java/cn/hutool/cache/LRUCacheTest.java index 6ccc2db2f..fdc6ea4be 100644 --- a/hutool-cache/src/test/java/cn/hutool/cache/LRUCacheTest.java +++ b/hutool-cache/src/test/java/cn/hutool/cache/LRUCacheTest.java @@ -1,7 +1,10 @@ package cn.hutool.cache; import cn.hutool.cache.impl.LRUCache; +import cn.hutool.core.thread.ThreadUtil; +import cn.hutool.core.util.RandomUtil; import org.junit.Assert; +import org.junit.Ignore; import org.junit.Test; import java.util.concurrent.CountDownLatch; @@ -13,6 +16,18 @@ import java.util.concurrent.CountDownLatch; */ public class LRUCacheTest { + @Test + @Ignore + public void putTest(){ + //https://github.com/dromara/hutool/issues/2227 + LRUCache cache = CacheUtil.newLRUCache(100, 10); + for (int i = 0; i < 10000; i++) { + //ThreadUtil.execute(()-> cache.put(RandomUtil.randomString(5), "1243", 10)); + ThreadUtil.execute(()-> cache.get(RandomUtil.randomString(5), ()->RandomUtil.randomString(10))); + } + ThreadUtil.sleep(3000); + } + @Test public void readWriteTest() throws InterruptedException { LRUCache cache = CacheUtil.newLRUCache(10);