This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-jcs.git
commit edd7734cc7bdd1d68b3beaa08ccc2b37065502c2 Author: Thomas Vandahl <[email protected]> AuthorDate: Fri Oct 2 15:50:54 2026 +0200 Use ParameterizedTest --- .../jcs4/JCSConcurrentCacheAccessUnitTest.java | 28 ++++++++-------------- 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/commons-jcs4-core/src/test/java/org/apache/commons/jcs4/JCSConcurrentCacheAccessUnitTest.java b/commons-jcs4-core/src/test/java/org/apache/commons/jcs4/JCSConcurrentCacheAccessUnitTest.java index 207495e7..c0191cd0 100644 --- a/commons-jcs4-core/src/test/java/org/apache/commons/jcs4/JCSConcurrentCacheAccessUnitTest.java +++ b/commons-jcs4-core/src/test/java/org/apache/commons/jcs4/JCSConcurrentCacheAccessUnitTest.java @@ -33,7 +33,8 @@ import org.apache.commons.jcs4.access.GroupCacheAccess; import org.apache.commons.jcs4.access.exception.CacheException; import org.apache.commons.jcs4.utils.timing.ElapsedTimer; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; /** * Test Case for JCS-73, modeled after the Groovy code by Alexander Kleymenov @@ -143,7 +144,14 @@ class JCSConcurrentCacheAccessUnitTest valueMismatchList = new CopyOnWriteArrayList<>(); } - private void testConcurrentAccess(String cacheName) + /** + * Test concurrent reads and writes on the named cache + * + * @throws Exception + */ + @ParameterizedTest + @ValueSource(strings = {"lhm_cache", "soft_cache", "lru_cache", "mru_cache", "fifo_cache", "lru_cache_with_disk"}) + void testConcurrentAccess(String cacheName) throws Exception { System.out.println(cacheName); @@ -172,20 +180,4 @@ class JCSConcurrentCacheAccessUnitTest valueMismatchList.clear(); cache.dispose(); } - - /** - * - * @throws Exception - */ - @Test - void testConcurrentAccess() - throws Exception - { - testConcurrentAccess("lhm_cache"); - testConcurrentAccess("soft_cache"); - testConcurrentAccess("lru_cache"); - testConcurrentAccess("mru_cache"); - testConcurrentAccess("fifo_cache"); - testConcurrentAccess("lru_cache_with_disk"); - } }
