From bf2da0543ecabbed4af8701b8b5e764d4b6fd21e Mon Sep 17 00:00:00 2001 From: Chamber6821 Date: Thu, 18 Apr 2024 03:00:23 +0300 Subject: [PATCH] test(MemCachedSearchEmployeeTest): overflow cache --- .../search/MemCachedSearchEmployeeTest.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/example/jonebook/services/search/MemCachedSearchEmployeeTest.java b/src/test/java/com/example/jonebook/services/search/MemCachedSearchEmployeeTest.java index 2c473fa..71e8816 100644 --- a/src/test/java/com/example/jonebook/services/search/MemCachedSearchEmployeeTest.java +++ b/src/test/java/com/example/jonebook/services/search/MemCachedSearchEmployeeTest.java @@ -13,7 +13,18 @@ public class MemCachedSearchEmployeeTest { void shouldReturnTheSameValueFromOrigin() { var pageable = PageRequest.of(0, 20); assertEquals(new MemCachedSearchEmployee((x, p) -> Page.empty(p)) - .search(EmployeeCriteria.builder().build(), pageable), - Page.empty(pageable)); + .search(EmployeeCriteria.builder().build(), pageable), + Page.empty(pageable)); + } + + @Test + void overflowCache() { + for (int i = 0; i < 100000; i++) { + var pageable = PageRequest.of(i, 20); + assertEquals( + new MemCachedSearchEmployee((x, p) -> Page.empty(p)) + .search(EmployeeCriteria.builder().build(), pageable), + Page.empty(pageable)); + } } }